共用方式為


PSScriptProperty Constructors

Definition

Overloads

PSScriptProperty(String, ScriptBlock)

Initializes an instance of the PSScriptProperty class as a read only property.

PSScriptProperty(String, ScriptBlock, ScriptBlock)

Initializes an instance of the PSScriptProperty class as a read only property. getterScript or setterScript can be null, but not both.

PSScriptProperty(String, ScriptBlock)

Initializes an instance of the PSScriptProperty class as a read only property.

public:
 PSScriptProperty(System::String ^ name, System::Management::Automation::ScriptBlock ^ getterScript);
public PSScriptProperty (string name, System.Management.Automation.ScriptBlock getterScript);
new System.Management.Automation.PSScriptProperty : string * System.Management.Automation.ScriptBlock -> System.Management.Automation.PSScriptProperty
Public Sub New (name As String, getterScript As ScriptBlock)

Parameters

name
String

Name of the property.

getterScript
ScriptBlock

Script to be used for the property getter. $this will be this PSObject.

Exceptions

For invalid arguments.

Applies to

PSScriptProperty(String, ScriptBlock, ScriptBlock)

Initializes an instance of the PSScriptProperty class as a read only property. getterScript or setterScript can be null, but not both.

public:
 PSScriptProperty(System::String ^ name, System::Management::Automation::ScriptBlock ^ getterScript, System::Management::Automation::ScriptBlock ^ setterScript);
public PSScriptProperty (string name, System.Management.Automation.ScriptBlock getterScript, System.Management.Automation.ScriptBlock setterScript);
new System.Management.Automation.PSScriptProperty : string * System.Management.Automation.ScriptBlock * System.Management.Automation.ScriptBlock -> System.Management.Automation.PSScriptProperty
Public Sub New (name As String, getterScript As ScriptBlock, setterScript As ScriptBlock)

Parameters

name
String

Name of this property.

getterScript
ScriptBlock

Script to be used for the property getter. $this will be this PSObject.

setterScript
ScriptBlock

Script to be used for the property setter. $this will be this PSObject and $args(1) will be the value to set.

Exceptions

For invalid arguments.

Applies to