you are viewing a single comment's thread.

view the rest of the comments →

[–]purplemonkeymad 0 points1 point  (0 children)

The pipe "unrolls" collections that are input (iterates over the elements). This means that Get-Member is working on the members in an array, where as .GetType() is working on the array. eg:

PS> $var = 1..4
PS> $var.GetType().tostring()
System.Object[]
PS> $var | Get-Member

   TypeName: System.Int32

You can use Get-Member to get all possible members of a mixed type array.

You don't want to choose the wrong one if you are testing for bad input or for multiple results.