Summary of the new feature / enhancement
Start-ThreadJob (and Start-Job for reference) currently only supports splatting -ArgumentList with array:
This means some example code must be like this:
$JobsUsingArray= [array](
1 ..3|ForEach-Object-Process {
Start-ThreadJob-ScriptBlock {
[OutputType([System.String])]
Param(
[Parameter(Mandatory,Position=0)][string]$SomeParameter
)
Write-Output-InputObject $SomeParameter
} -ArgumentList ('Hello {0}'-f$_)
}
)
Receive-Job-Job $JobsUsingArray-Waitwhich returns:
I much prefer to splat using name of the input parameters, so splatting with hashtable. I'd like this to work too:
$JobsUsingHashtable= [array](
1 ..3|ForEach-Object-Process {
Start-ThreadJob-ScriptBlock {
[OutputType([System.String])]
Param(
[Parameter(Mandatory)][string]$SomeParameter
)
Write-Output-InputObject $SomeParameter
} -ArgumentList @{
'SomeParameter'= [string] 'Hello {0}'-f$_
}
}
)
Receive-Job-Job $JobsUsingHashtable-Waitwhich returns
System.Collections.Hashtable
System.Collections.Hashtable
System.Collections.Hashtable
Proposed technical implementation details (optional)
No response
Summary of the new feature / enhancement
Start-ThreadJob(andStart-Jobfor reference) currently only supports splatting-ArgumentListwith array:This means some example code must be like this:
which returns:
I much prefer to splat using name of the input parameters, so splatting with hashtable. I'd like this to work too:
which returns
Proposed technical implementation details (optional)
No response