Detecting a PowerShell Switch
问题 I'm developing a PowerShell cmdlet in C#, and have true/false switch statements. I have noted that I need to specify -SwitchName $true, if I want the bool to be true, otherwise I get: Missing an argument for parameter 'SwitchName'. Specify a parameter of type 'System.Boolean' and try again. The switch is decorated as such: [Parameter(Mandatory = false, Position = 1, , ValueFromPipelineByPropertyName = true)] How can I just detect the presence of the switch (-SwitchName sets to true, absence