Defining an enumeration
An enumeration is a set of named, numeric constants that provides a relatively simple introduction to creating types. .NET is full of examples of enumerations. For example, the System.Security.AccessControl.FileSystemRights enumeration describes all of the numeric values that are used to define access rights for files or directories.
Enumerations are also used by PowerShell. For example, System.Management.Automation.ActionPreference contains the values for the preference variables, such as ErrorActionPreference and DebugPreference.
Enumerations are created by using the enum keyword followed by a list of names and values:
enum MyEnum {
First = 1
Second = 2
Third = 3
}
Each name must be unique within the enumeration and must start with a letter or an underscore. The name may contain numbers after the first character. The name cannot be quoted and cannot contain the hyphen character.
The value does not have to be unique. One...