October 5th, 2014

PowerTip: View All Values of an Enum

Doctor Scripto
Scripter

Summary: Boe Prox shows how to view all values of an enum.

Hey, Scripting Guy! Question How can I view all of the available values of an enum?

Hey, Scripting Guy! Answer Use the [Enum]::GetNames() method, for example:

PS C: > [Enum]::GetNames([System.ConsoleColor])

Black

DarkBlue

DarkGreen

DarkCyan

DarkRed

DarkMagenta

DarkYellow

Gray

DarkGray

Blue

Green

Cyan

Red

Magenta

Yellow

White

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.