Skip to main content
Made compliant with the Jon Skeet Decree - <https://twitter.com/PeterMortensen/status/976400000942034944>.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

It's easier than you think - an enum is already an int. ItIt just needs to be reminded:

int y = (int)Question.Role;
Console.WriteLine(y); // printsPrints 2

It's easier than you think - an enum is already an int. It just needs to be reminded:

int y = (int)Question.Role;
Console.WriteLine(y); // prints 2

It's easier than you think - an enum is already an int. It just needs to be reminded:

int y = (int)Question.Role;
Console.WriteLine(y); // Prints 2
Rollback to Revision 4
Source Link
jim
  • 27.5k
  • 14
  • 54
  • 66

It's easier than you think - youran enum is already an intint. It It just needs to be reminded:

int y = (int)Question.Role;
Console.WriteLine(y); // prints 2

Every enumeration type has an underlying type, which can be any integral type, except char.

It's easier than you think - your enum is already an int. It just needs to be reminded:

int y = (int)Question.Role;
Console.WriteLine(y); // prints 2

Every enumeration type has an underlying type, which can be any integral type, except char.

It's easier than you think - an enum is already an int. It just needs to be reminded:

int y = (int)Question.Role;
Console.WriteLine(y); // prints 2
Rollback to Revision 3
Source Link
jim
  • 27.5k
  • 14
  • 54
  • 66

It's easier than you think - anyour enum is already an intint. ItIt just needs to be reminded:

int y = (int)Question.Role;
Console.WriteLine(y); // prints 2

Every enumeration type has an underlying type, which can be any integral type, except char.

It's easier than you think - an enum is already an int. It just needs to be reminded:

int y = (int)Question.Role;
Console.WriteLine(y); // prints 2

It's easier than you think - your enum is already an int. It just needs to be reminded:

int y = (int)Question.Role;
Console.WriteLine(y); // prints 2

Every enumeration type has an underlying type, which can be any integral type, except char.

Rollback to Revision 1
Source Link
jim
  • 27.5k
  • 14
  • 54
  • 66
Loading
added 102 characters in body
Source Link
Michael Petrotta
  • 61.1k
  • 27
  • 153
  • 181
Loading
Source Link
Michael Petrotta
  • 61.1k
  • 27
  • 153
  • 181
Loading