Enums, Enums, Enums, a One-Liner

Enums are short for Enumerations, which is a fancy way of saying, “map this [string] to that [int].”  They’re handy when you want to limit choices, such as ‘Continue’, ‘SilentlyContinue’, etc.

In this case, I’m looking at the System.Net.NetworkInformation.OperationalStatus [enum]. How do I get the possible values?

[enum]::GetNames(System.Net.NetworkInformation.OperationalStatus)

For those familiar with .NET, this is pretty basic.  For the rest of us, it’s something out there in SearchEngineLandia, but I keep having to look for it each time, hence my putting it here.