Pregunta

Suppose I have the following setup:

$arr = @()
for($i=0;$i -lt 100; $i++) {
  $obj = New-Object myType
  $obj.intMember = $i
  $arr += $obj
}

And I want to turn this into an array of integers. My approach would be:

$intArr = Select-Object intMember

But this doesn't seem to be doing what I want. How do I get an actual integer array from this?

¿Fue útil?

Solución

I found the answer.

$intArr = Select-Object -ExpandProperty intMember
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top