Reputation: 16236
Get-Member returns an object name and member list for each type of object it contains.
PS C:\src\t\getlast> $a = @(1,'now')
PS C:\src\t\getlast> $a | gm
TypeName: System.Int32
...
TypeName: System.String
...
Is there a way to get the object name and member list for the array object itself? Creating an array containing an array and a different type is the only way I have found to get a list of members for an array object.
PS C:\src\t\getlast> $a = @(@(1),'now')
PS C:\src\t\getlast> $a.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
PS C:\src\t\getlast> $a | gm
TypeName: System.Object[]
...
TypeName: System.String
...
Upvotes: 4
Views: 586
Reputation: 10019
Get-Member -InputObject $a
Essentially, feed Get-Member
the whole object as using the pipeline pipes it element by element.
Upvotes: 6