January 2011
Intermediate to advanced
1648 pages
70h 30m
English
Related to constants are enums, which are value types that contain for their members a set of named constants. A typical example of an enum is Color, as shown here:
enum Color{ Red, Green, Blue,}
Right inside the framework you can find quite a few enums, as well; for example, to indicate a “file open mode” when using System.IO APIs. Just like other value types, you can apply an access modifier to the type.
Notice that an enum’s members are comma separated and not semicolon separated. Basically, they denote a list of symbolic values. A trailing comma is allowed after the last member, which is often put there so that the addition of new members to the enum doesn’t show up while comparing ...
Read now
Unlock full access