Questions tagged «member-enumeration»

4
在PowerShell中选择数组的所有对象上一个属性的值
假设我们有一个对象数组$ objects。假设这些对象具有“名称”属性。 这就是我想做的 $results = @() $objects | %{ $results += $_.Name } 这行得通,但是可以用更好的方法做到吗? 如果我做类似的事情: $results = objects | select Name $results是具有Name属性的对象数组。我希望$ results包含一个Names数组。 有没有更好的办法?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.