PowerShell: Array Sub-Expression Operator @(), Collection to Array
Array Sub-Expression Operator
Array can be created by the Array Sub-Expression Operator. It has the syntax
@(args)
it forces the result to be an array.
$x = @(3, 4, 5)
# comma optional if in multi line $x = @( 3 4 5);
Create a Empty Array
# create a empty array $x = @(); $x.length
Convert Collection to Array
It is often used to turn a collection into an Array.
@(command)
# turn dir result into an array, and use array method length to get count @(dir).length
PowerShell: Array
- PowerShell: Array
- PowerShell: Array Sub-Expression Operator @(), Collection to Array
- PowerShell: Array and Types
- PowerShell: Nested Array, Multi-Dimensional Array
- PowerShell: Array, Get Item
- PowerShell: Array, Set Item
- PowerShell: Test If Collection Contains a Value
- PowerShell: Join Array, Append
- PowerShell: Filter Array
- PowerShell: Delete Array, Clear Array
- PowerShell: Array to String
- PowerShell: Array Methods
- PowerShell: Iterate Array