PowerShell: Array and Types

By Xah Lee. Date: . Last updated: .

Get Type of Array

$x = @(3, 4, 5)
$x.gettype().fullname
# System.Object[]

Default Type of Array

by default, array are created of type System.Object[]

$x = @(3, 4, 5)
$x.gettype().fullname
# System.Object[]

Create a Strongly Typed Array

# create a array of int32 type
[int32[]] $x = @(3, 4, 5)
$x.gettype().fullname
# System.Int32[]

PowerShell. Array