BTW, my example did not return members of String[] as you might have intended
to see, so here is a simplified version of your example that does this:
#members of [String[]]
[String]$a = "foo"
[String[]]$b = $a,$a
$b | % {gm -i $b}
This would be a more simplified example on the 'bug' your were seeing:
#members of [String]
"foo","bar" | % {$_ | gm}
--
greetings
dreeschkind
"dreeschkind" wrote:
> I'm not 100% sure, but I think this is what's going on:
>
> Get-Member usually gives you member information only once for every type you
> pipe into it (or hand over to it using -InputObject).
> What you are doing is actually calling Get-Member several times
> (Foreach-Object) and with one single object each time. So every time
> Get-Member is invoked it returns type information for one single object
> (String[]).
> After that the all generated
> "Microsoft.PowerShell.Commands.MemberDefinition"-objects get automagically
> piped into PoSh's magic formating cmdlets, which recognize that all have
> actually the same type and thus present the header
> "Name MemberType Definition" only once for all members.
>
> I hope that makes sense for you.
> Please someone correct my if I'm wrong.
>
> --
> greetings
> dreeschkind
>
>
> "Alex K. Angelopoulos [MVP]" wrote:
>
> > I was trying a few esoteric methods for collecting information, and noticed
> > an oddity when I was trying to find properties of repeated String[]
> > objects: Get-Member would repeat identical members over and over, under a
> > single System.String typename. Example below. Anyone know the reason for
> > this? My hunch is it is probably a bug and is probably due to repeated
> > hard-typed arrays:
> >
> > PS> Get-ChildItem hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
> > | ForEach-Object { Get-Member -InputObject $_.GetValueNames() } |
> > Select-Object -First 200
> >
> >
> > TypeName: System.String[]
> >
> > Name MemberType Definition
> > ---- ---------- ----------
> > Count AliasProperty Count = Length
> > Address Method System.String& Address(Int32 )
> > ....
> > Rank Property System.Int32 Rank {get;}
> > SyncRoot Property System.Object SyncRoot {get;}
> > Count AliasProperty Count = Length
> > Address Method System.String& Address(Int32 )
> > ....
> > Rank Property System.Int32 Rank {get;}
> > SyncRoot Property System.Object SyncRoot {get;}
> > Count AliasProperty Count = Length
> > Address Method System.String& Address(Int32 )
> > ....
> > Rank Property System.Int32 Rank {get;}
> > SyncRoot Property System.Object SyncRoot {get;}
> > Count AliasProperty Count = Length
> > Address Method System.String& Address(Int32 )
> > ....
> >
> >
> >