Condividi tramite


SwitchParameter Struct

Definition

Type used to define a parameter on a cmdlet script of function that can only be used as a switch.

public value class SwitchParameter
public struct SwitchParameter
[System.Runtime.CompilerServices.IsReadOnly]
public readonly struct SwitchParameter
type SwitchParameter = struct
[<System.Runtime.CompilerServices.IsReadOnly>]
type SwitchParameter = struct
Public Structure SwitchParameter
Inheritance
SwitchParameter
Attributes

Constructors

SwitchParameter(Boolean)

Construct a SwitchParameter instance with a particular value.

Properties

IsPresent

Returns true if the parameter was specified on the command line, false otherwise.

Present

Static method that returns a instance of SwitchParameter that indicates that it is present.

Methods

Equals(Object)

Compare this switch parameter to another object.

GetHashCode()

Returns the hash code for this switch parameter.

ToBool()

Explicit method to convert a SwitchParameter to a boolean value.

ToString()

Returns the string representation for this object.

Operators

Equality(Boolean, SwitchParameter)

Implement the == operator for bool and switch parameters.

Equality(SwitchParameter, Boolean)

Implement the == operator for switch parameters and booleans.

Equality(SwitchParameter, SwitchParameter)

Implement the == operator for switch parameters objects.

Implicit(Boolean to SwitchParameter)

Implicit cast operator for casting bool to SwitchParameter.

Implicit(SwitchParameter to Boolean)

Implicit cast operator for casting SwitchParameter to bool.

Inequality(Boolean, SwitchParameter)

Implement the != operator for bool and switch parameters.

Inequality(SwitchParameter, Boolean)

Implement the != operator for switch parameters and booleans.

Inequality(SwitchParameter, SwitchParameter)

Implement the != operator for switch parameters.

Applies to