1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PowerShellで多次元配列に配列を追加

Last updated at Posted at 2021-04-06

powershellで多次元配列に後から値を追加したいパターン。

連想配列と同様の構文で「$arr += @()」で追加できるかと思いきや、罠があったので共有。

[array] $namelist = @(
    @('佐藤'  , '一郎'),
    @('鈴木'  , '二郎'),
    @('田中'  , '三郎'),
);

# @マーク手前のカンマが肝。
$namelist += ,@('伊藤', '四郎');

癖が強いんじゃ。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?