luni, 25 august 2014

Enum type c# example

Enum is s type that contains of a set of named constants called the enumerator list. 
By default the first enumerator has the value 0, and the value of each successive enumerator is increased by 1. 

Example:

enum SomeMonths { January, February, March };
 enum OtherMonths { April = 1, May }; //Enumerators can use initializers to override the default values

int v = (int)SomeMonths.January; // 0
v = (int)OtherMonths.May; // 2



Niciun comentariu:

Trimiteți un comentariu