更新时间:2023-11-17 13:10:10
Bruce Payette的答案将起作用.语法对我来说似乎有点尴尬,但它确实有效.至少不是Perl.
The answer from Bruce Payette will work. The syntax seems a bit awkward to me, but it does work. At least it is not Perl.
执行此操作的另一种方法是使用ArrayList
.对我来说,这种语法更清晰,并且更可能在六个月内被另一个开发人员(或我本人)理解.
Another way to do this would be with an ArrayList
. To me, this syntax is more clear and more likely to be understood by another developer (or myself) in six months.
[System.Collections.ArrayList]$al = @()
$al.Add(@(1,2))
$al.Add(@(3,4))
foreach ($e in $al) {
$e
$e.GetType()
}