February 2019
Intermediate to advanced
626 pages
15h 51m
English
An enumeration is a set of named constants. The .NET framework 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 in PowerShell itself, for example, System.Management.Automation.ActionPreference contains the values for the preference variables, such as ErrorActionPreference and DebugPreference.
Enumerations are created using the enum keyword, and this is followed by a list of 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 ...
Read now
Unlock full access