I am learning about Extended Type System from MSDN, I’ve learned the fact that all objects in pwsh has intrinsic members like psobject
, pstypenames
etc. Does this implies all object in pwsh is [psobject]
? If it does, why does -is [psobject]
returns false for some object like a native number literal 123
. And I noticed that the object that’s not a [psobject]
will be converted as [psobject]
after being piped into a cmdlet. So there’s yet another question, when will pwsh implicitly convert an object into [psobject]
? And when do we need to explicitly convert to it?
1 -is [psobject] # False
1 | % { $_ -is [psobject] } # True
After finishing writing this question, I started thinking that those views like pstypenames
and other intrinsic members are not part of the [psobject]
? I am not sure just a guess. So are they more primitive things in pwsh that cannot be described by a type?
1 -is [psobject] # False
1 | gm -MemberType MemberSet, CodeProperty -Force # object views returned
jamgoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.