标签:style blog color sp div on log bs as
//枚举类型是一种的值类型,它用于声明一组命名的常数。 //(1)枚举的声明:枚举声明用于声明新的枚举类型。 访问修辞符 enum 枚举名:基础类型 { 枚举成员 } //示例: public enum TimeofDay:uint { Morning, Afternoon, Evening } //Morning的值为0,Afternoon的值为1,Evening的值为2。 class Test { static void WriteGreeting(TimeofDay timeofDay) { switch(timeofDay) { case TimeofDay.Morning: Console.WriteLine("good morning"); break; case TimeofDay.Afternoon: Console.WriteLine("good afternoon"); break; case TimeofDay.Evening: Console.WriteLine("good evening"); break; } } static void Main() { WriteGreeting(TimeofDay.Morning); WriteGreeting(TimeofDay.Evening); WriteGreeting(TimeofDay.Afternoon); } }
标签:style blog color sp div on log bs as
原文地址:http://www.cnblogs.com/quke123/p/4101381.html