Directory
First, we will introduce the differences between the two.
1. A constant is a value, and an enumeration is a set of unchanged values.
2. enumeration is defined by yourself before use. There are certain constraints and constants can be defined at will.
3. If the input value of enumeration is a fixed value, no error will occur. The constant is a value and the passed parameter is arbitrary.
4. restrict users from assigning values at will. You can only select values in the enumerated values. You do not need to memorize each value. You only need to select the corresponding value.
Advantages of enumeration:
Enumeration makes the code easier to maintain and helps to specify valid and expected values for the variable.
Enumeration makes the code clearer. descriptive names are allowed to represent integer values, rather than fuzzy numbers.
Enumeration makes the code easier to type. When assigning values to enumeration instances, VS. net ide uses intelliisense to pop up a list box containing acceptable values, which reduces the number of buttons and allows us to recall possible values.
Reference resources:
Http://www.cnblogs.com/daniel206/archive/2008/01/16/1041745.html
Http://blog.sina.com.cn/s/blog_6f3da82b01011oxd.html
Http://zhidao.baidu.com/question/112136992.html
Http://www.cnblogs.com/yank/archive/2009/02/27/1399423.html