wwwroot> $nsmgr.gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False XmlNamespaceManager System.Object
wwwroot> Get-Member -InputObject $nsmgr
TypeName: System.Xml.XmlNamespaceManager
wwwroot> $nsmgr | Get-Member
TypeName: System.String
It seems like Get-Member is type-converting to a String in first Get-Member call, but this seems to be very strange behavior for a Cmdlet like Get-Member.
I’ve read How to use PowerShell Get-Member cmdlet but I don’t believe that’s the same issue.
XmlNamespaceManager implements
IEnumerableso PowerShell will output the items contained within the XmlNamespaceManager down the pipeline. To prevent that you can use the comma operator:This will create a simple array wrapper around the XmlNamespaceManager so that it gets propagated down the pipe instead of its contents.