Using system; using system. collections. generic; using system. LINQ; using system. text; using system. collections; namespace consoleapplication1 {// enumeration Declaration: Access rhetoric Enum enumeration name: Basic Type Public Enum enumname: int // This int can omit {enumeration member} // the basic type must be able to represent all enumeration values defined in this enumeration. Enumeration declaration can explicitly declare the byte, sbyte, short, ushort, Int, uint, long, or ulong types as the corresponding basic types. The enumeration declaration without explicitly declaring the basic type means that the corresponding basic type is int. // The default basic type of enumeration elements is int. By default, the value of the first enumeration number is 0, and the value of each enumeration number increases by 1. Enum days {sat, sun, Mon, Tue, wed, Thu, Fri}; then // The default value is Enum days {0, 1, 2, 3, 4, 5, 6 }, if you want to set the default value to 1, you must start with Enum days {stat = 1, Sun = 2 ,.....} // The enumerated member is the name constant of the enumerated type. Any two enumeration members cannot have the same name. Each enumerated member has an associated constant value. The type of this value is the basic type of enumeration. The constant value of each enumeration member must be within the range of the basic Enumeration type. Enum Gender: uint {// male =-3, female =-2, unkown =-1 // generate a compile-time error, the reason is that the common values-1,-2, and-3 are not in the range of the basic integer uint. }; // Defines an enumeration. This enumeration has three values: moning, afternoon, evening Enum timeofday {moning, afternoon, evening}; // The value of morning is 0, the afternoon value is 1, and the evening value is 2. Class program {public static string Week (timeofday Str) // defines a week method, which has a timeofday parameter STR {string result = string. empty; Switch (STR) {// timeofday. the default value of moning is 0 case timeofday. moning: Result = "Morning"; break; Case timeofday. afternoon: result = "Afternoon"; break; Case timeofday. evening: Result = "Evening"; break;} return result;} static void main (string [] ARGs) {string S = program. week (timeofday. moning); console. writeline (s); // output the morning console. readkey ();}}}