In PowerShell 1.0, if I have a cmdlet parameter for an enumeration type, what is the recommended method for checking if the user specified this parameter on the cmdlet command line? For example:
MyEnum : int { No = 0, Yes = 1, MaybeSo = 2 }
class DoSomethingCommand : PSCmdlet
...
private MyEnum isEnabled;
[Parameter(Mandatory = false)]
public MyEnum IsEnabled
{
get { return isEnabled; }
set { isEnabled = value; }
}
protected override void ProcessRecord()
{
}
Is there a way to do this without an isEnabled seed with a dummy value? By default, it will be 0, and I don’t want the seed of each parameter or add a dummy value to my enumeration. I potentially got many cmdlets with 100 parameters, there should be a better way. This is related to this question , but I was looking for a cleaner way to do this. Thank you