February 2019
Intermediate to advanced
626 pages
15h 51m
English
An enumeration may be created without defining a value for a name. PowerShell will automatically allocate a sequence of values starting from 0. In the following example, the names Zero and One are automatically created with the values 0 and 1, respectively:
enum MyEnum { Zero One}
If a value is assigned to a name, the sequence will continue from that point. The following example starts with the value 5; Six will automatically be given the value 6:
enum MyEnum { Five = 5 Six}
Automatic value assignment supports non-contiguous sets. The sequence may be restarted at any point, or values may be skipped. The following example demonstrates both restarting a sequence and skipping values in a sequence:
enum MyEnum { One ...Read now
Unlock full access