Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SwitchParameter Constructor (Boolean)

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Initializes a new instance of the SwitchParameter class that identifies whether the switch is present.

Namespace:   System.Management.Automation
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

public SwitchParameter(
	bool isPresent
)

Parameters

isPresent
Type: System.Boolean

true to specify that the parameter is present; otherwise, false.

The following example shows how to declare a parameter of type SwitchParameter.

protected override void ProcessRecord()
{
  WriteObject("Switch parameter test: " + userName + ".");
  if(goodbye)
  {
    WriteObject(" Goodbye!");
  }
} // End ProcessRecord

Return to top

Community Additions

Show: