The FunWithArrays application is located under the Chapter 4 subdirectory.
Understanding the Enum Type
Recall from Chapter 1 that the .NET type system is composed of classes, structures, enumerations,
interfaces, and delegates. To begin our exploration of these types, let’s check out the role of the
enumeration (or simply, enums) using a new Console Application project named FunWithEnums.
When building a system, it is often convenient to create a set of symbolic names that map to
known numerical values. For example, if you are creating a payroll system, you may want to refer
to the type of employees using constants such as vice president, manager, contractor, and grunt.
C# supports the notion of custom enumerations for this very reason. For example, here is an
enumeration named EmpType:
Do'stlaringiz bilan baham: