Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the function of enumeration in c#?
What is the function of enumeration in c#?
Enumeration is a data type of value type, which contains its own values and cannot inherit or pass on inheritance.

For example, you may need to write a program to represent the week. Saturday, Sunday, Monday and Tuesday can be represented by integers 0, 1, 2 and 3. This representation can be used, but there will be problems. Inconvenient. If an integer value of 0 is used in the code, 0 cannot clearly indicate Sunday or Saturday. To overcome this problem, you can use enumeration.

(The above is taken from Borui Software Engineer Course)