ScriptBlock.InvokeWithContext Method

Definition

Overloads

InvokeWithContext(Dictionary<String,ScriptBlock>, List<PSVariable>, Object[])

A method that allows a scriptblock to be invoked with additional context in the form of a set of local functions and variables to be defined in the scriptblock's scope. The list of variables may include the special variables $input, $_ and $this.

InvokeWithContext(IDictionary, List<PSVariable>, Object[])

A method that allows a scriptblock to be invoked with additional context in the form of a set of local functions and variables to be defined in the scriptblock's scope. The list of variables may include the special variables $input, $_ and $this.

This overload of the function takes a hashtable and converts it to the required dictionary which makes the API easier to use from within a PowerShell script.

InvokeWithContext(Dictionary<String,ScriptBlock>, List<PSVariable>, Object[])

A method that allows a scriptblock to be invoked with additional context in the form of a set of local functions and variables to be defined in the scriptblock's scope. The list of variables may include the special variables $input, $_ and $this.

public:
 System::Collections::ObjectModel::Collection<System::Management::Automation::PSObject ^> ^ InvokeWithContext(System::Collections::Generic::Dictionary<System::String ^, System::Management::Automation::ScriptBlock ^> ^ functionsToDefine, System::Collections::Generic::List<System::Management::Automation::PSVariable ^> ^ variablesToDefine, ... cli::array <System::Object ^> ^ args);
public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> InvokeWithContext (System.Collections.Generic.Dictionary<string,System.Management.Automation.ScriptBlock> functionsToDefine, System.Collections.Generic.List<System.Management.Automation.PSVariable> variablesToDefine, params object[] args);
member this.InvokeWithContext : System.Collections.Generic.Dictionary<string, System.Management.Automation.ScriptBlock> * System.Collections.Generic.List<System.Management.Automation.PSVariable> * obj[] -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>
Public Function InvokeWithContext (functionsToDefine As Dictionary(Of String, ScriptBlock), variablesToDefine As List(Of PSVariable), ParamArray args As Object()) As Collection(Of PSObject)

Parameters

functionsToDefine
Dictionary<String,ScriptBlock>

A dictionary of functions to define.

variablesToDefine
List<PSVariable>

A list of variables to define.

args
Object[]

The arguments to the actual scriptblock.

Returns

Applies to

InvokeWithContext(IDictionary, List<PSVariable>, Object[])

A method that allows a scriptblock to be invoked with additional context in the form of a set of local functions and variables to be defined in the scriptblock's scope. The list of variables may include the special variables $input, $_ and $this.

This overload of the function takes a hashtable and converts it to the required dictionary which makes the API easier to use from within a PowerShell script.

public:
 System::Collections::ObjectModel::Collection<System::Management::Automation::PSObject ^> ^ InvokeWithContext(System::Collections::IDictionary ^ functionsToDefine, System::Collections::Generic::List<System::Management::Automation::PSVariable ^> ^ variablesToDefine, ... cli::array <System::Object ^> ^ args);
public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> InvokeWithContext (System.Collections.IDictionary functionsToDefine, System.Collections.Generic.List<System.Management.Automation.PSVariable> variablesToDefine, params object[] args);
member this.InvokeWithContext : System.Collections.IDictionary * System.Collections.Generic.List<System.Management.Automation.PSVariable> * obj[] -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>
Public Function InvokeWithContext (functionsToDefine As IDictionary, variablesToDefine As List(Of PSVariable), ParamArray args As Object()) As Collection(Of PSObject)

Parameters

functionsToDefine
IDictionary

A dictionary of functions to define.

variablesToDefine
List<PSVariable>

A list of variables to define.

args
Object[]

The arguments to the actual scriptblock.

Returns

Applies to