Title: Why is [pscustomobject] the same as [psobject], even though a distinct [System.Management.Automation.PSCustomObject] type exists? · Issue #4344 · PowerShell/PowerShell · GitHub
Open Graph Title: Why is [pscustomobject] the same as [psobject], even though a distinct [System.Management.Automation.PSCustomObject] type exists? · Issue #4344 · PowerShell/PowerShell
X Title: Why is [pscustomobject] the same as [psobject], even though a distinct [System.Management.Automation.PSCustomObject] type exists? · Issue #4344 · PowerShell/PowerShell
Description: 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, thi...
Open Graph Description: 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.Auto...
X Description: 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.Auto...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/4344
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Why is [pscustomobject] the same as [psobject], even though a distinct [System.Management.Automation.PSCustomObject] type exists?","articleBody":"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.\r\n\r\nMostly, this conflation goes unnoticed (and has come up before - see #2295), but:\r\n\r\n* what is the rationale for it?\r\n\r\n* it makes for surprising behavior on occasion - see below.\r\n\r\n```powershell\r\n# Even though their names strongly suggest identity, they are different types.\r\n\u003e [pscustomobject] -eq [System.Management.Automation.PSCustomObject]\r\nFalse\r\n\r\n# Any object returned by a *command* (as opposed to an expression)\r\n# returns $True for -is [psobject], and therefore also [pscustomobject]\r\n\u003e (Get-Item /) -is [pscustomobject]\r\nTrue\r\n\r\n# Casting anything other than a hashtable literal to [psobject] is a no-op, \r\n# and therefore also with [pscustomobject]\r\n\u003e ([pscustomobject] 666).GetType().Name\r\nInt32\r\n```\r\n\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```powershell\r\nPowerShell Core v6.0.0-beta.4\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2017-07-26T04:33:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/4344/PowerShell/issues/4344"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b20977b4-5acc-7e7d-dde1-43ea3055ee55 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A69E:1A0701:B907FA:1057589:6A5A173F |
| html-safe-nonce | ad46f90107559d56b0e21a5ba1d5842b80f29d027d21c6e4e1db63ba66f66689 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjlFOjFBMDcwMTpCOTA3RkE6MTA1NzU4OTo2QTVBMTczRiIsInZpc2l0b3JfaWQiOiI2NTI5MjAxNjQ4NzExNjM2Nzk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 878159bcb84fc3c9bfbec116f89952d2d02ce1b6fa60ad27a3cfbfa980e664aa |
| hovercard-subject-tag | issue:245603596 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/4344/issue_layout |
| twitter:image | https://opengraph.githubassets.com/06e34f7ccd8afb8c38cc226a5e5ec237101052fb921f3c637b614b3a9c33bc71/PowerShell/PowerShell/issues/4344 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/06e34f7ccd8afb8c38cc226a5e5ec237101052fb921f3c637b614b3a9c33bc71/PowerShell/PowerShell/issues/4344 |
| og:image:alt | 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.Auto... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8c2fe7351e4e987cb8f75e2425a0b895d807779bc4c2d3c312be0a54082219f7 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 501ec24a694e4933bb3d70e768b1461c0def57a2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width