December 2012
Intermediate to advanced
612 pages
14h 4m
English
![]()
This chapter will discuss one of the nice features of the C# language: enumerated type or enum for short. I will show you how the enum type is defined in the .NET Framework, how you can get symbolic names and values from the enum, and how enum parses in C#.
Enum in C# is a type, which is a set of symbolic names and values (given by you or the C# compiler) pair. For example:
public enum Planets
{
Sun = 0,
Earth,
}
Or with the explicit type:
public enum Planets : int /* int is the underlying type which C# compiler will use to set
* the values */ { ...