You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Surprisingly, [pscustomobject] is the same as [psobject]: both these type accelerators point to type [System.Management.Automation.PSObject], even though there is a distinct [System.Management.Automation.PSCustomObject] type.
Mostly, this conflation goes unnoticed (and has come up before - see #2295), but:
what is the rationale for it?
it makes for surprising behavior on occasion - see below.
# Even though their names strongly suggest identity, they are different types.> [pscustomobject] -eq [System.Management.Automation.PSCustomObject]
False
# Any object returned by a *command* (as opposed to an expression)# returns $True for -is [psobject], and therefore also [pscustomobject]> (Get-Item/) -is [pscustomobject]
True
# Casting anything other than a hashtable literal to [psobject] is a no-op, # and therefore also with [pscustomobject]> ([pscustomobject] 666).GetType().Name
Int32
Surprisingly,
[pscustomobject]is the same as[psobject]: both these type accelerators point to type[System.Management.Automation.PSObject], even though there is a distinct[System.Management.Automation.PSCustomObject]type.Mostly, this conflation goes unnoticed (and has come up before - see #2295), but:
what is the rationale for it?
it makes for surprising behavior on occasion - see below.
Environment data