PowerShell:数组表示法之间的区别?

jra*_*ara 3 arrays powershell notation powershell-2.0

这两个数组创建语句之间有区别吗?那么,在创建数组时,'@'是可选的吗?

$a = "This", "Is", "a", "cat"
$a.GetType()
$a | gm
$a = @("This", "Is", "a", "cat")
$a.GetType()
$a | gm
Run Code Online (Sandbox Code Playgroud)

CB.*_*CB. 6

$a = @() # declare an empty array.

$a = @(mysingleitem) # declare an array with a single element
Run Code Online (Sandbox Code Playgroud)

在其他情况下是可选的.