April 2013
Intermediate to advanced
1700 pages
92h 51m
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 application programming interfaces (APIs). Just like other value types, you can apply an access modifier to the type.
Note: (Trailing) Commas
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 ...
Read now
Unlock full access