powershellで多次元配列に後から値を追加したいパターン。
連想配列と同様の構文で「$arr += @()」で追加できるかと思いきや、罠があったので共有。
[array] $namelist = @(
@('佐藤' , '一郎'),
@('鈴木' , '二郎'),
@('田中' , '三郎'),
);
# @マーク手前のカンマが肝。
$namelist += ,@('伊藤', '四郎');
癖が強いんじゃ。
Go to list of users who liked
More than 3 years have passed since last update.
powershellで多次元配列に後から値を追加したいパターン。
連想配列と同様の構文で「$arr += @()」で追加できるかと思いきや、罠があったので共有。
[array] $namelist = @(
@('佐藤' , '一郎'),
@('鈴木' , '二郎'),
@('田中' , '三郎'),
);
# @マーク手前のカンマが肝。
$namelist += ,@('伊藤', '四郎');
癖が強いんじゃ。
Register as a new user and use Qiita more conveniently
Go to list of users who liked