public enum MonthOfYear
{
January = 1,
February = 2,
March = 3,
April = 4,
May = 5,
June = 6,
July = 7,
August = 8,
Septemper = 9,
October = 10,
November = 11,
December = 12
}
- Get Array with Enum
//array with months List
Array array = Enum.GetValues(typeof(MonthOfYear));
- cast to enum from a value
int month = 1 ;
//currentMonth will become Jan
MonthOfYear currentMonth = (MonthOfYear) month ;
No comments:
Post a Comment