当我尝试为数组的特定索引分配一个值时,它显示了错误。
PS /home/mifi> $names = @()
PS /home/mifi> $names[1]="abc"
Index was outside the bounds of the array.
At line:1 char:1
+ $names[1]="abc"
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], IndexOutOfRangeException
+ FullyQualifiedErrorId : System.IndexOutOfRangeException
pwsh -v
PowerShell v6.0.2
`