Title: Make Get-Member support inspecting a type / instance's .NET interfaces and their members · Issue #13865 · PowerShell/PowerShell · GitHub
Open Graph Title: Make Get-Member support inspecting a type / instance's .NET interfaces and their members · Issue #13865 · PowerShell/PowerShell
X Title: Make Get-Member support inspecting a type / instance's .NET interfaces and their members · Issue #13865 · PowerShell/PowerShell
Description: Summary of the new feature/enhancement As a user in general, but especially as a script author, I want to be able to: (a) given a concrete instance or type, inspect the .NET interfaces it implements... ... including what members implemen...
Open Graph Description: Summary of the new feature/enhancement As a user in general, but especially as a script author, I want to be able to: (a) given a concrete instance or type, inspect the .NET interfaces it implement...
X Description: Summary of the new feature/enhancement As a user in general, but especially as a script author, I want to be able to: (a) given a concrete instance or type, inspect the .NET interfaces it implement...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/13865
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make Get-Member support inspecting a type / instance's .NET interfaces and their members","articleBody":"## Summary of the new feature/enhancement\r\n\r\nAs a user in general, but especially as a script author, I want to be able to:\r\n\r\n* (a) given a concrete instance or type, **inspect the .NET interfaces it implements...**\r\n * ... **including what members implement these interfaces** (thereby implicitly indicating the members that make up the interface), with an indication as to whether the interface implementation is implicit or explicit.\r\n * making the existing `-View` parameter accept a new `Interface` value could provide this, optionally combined with the `-Name` parameter for filtering by interface type name:\r\n\r\n```powershell\r\n# WISHFUL THINKING\r\n# Note that *explicit* interface implementations should be recognizable as such, as in Get-Member's normal output.\r\nPS> @{} | Get-Member -View Interface -Name *dictionary* # without -Name, *all* interfaces and their members would be listed.\r\n\r\n TypeName: System.Collections.IDictionary\r\n\r\nName MemberType Definition\r\n---- ---------- ----------\r\nAdd Method void Add(System.Object key, System.Object value), void IDictionary.Add(System.Object key, \r\n# ...\r\nIsFixedSize Method bool IsFixedSize {get;}\r\n# ...\r\n```\r\n\r\n* (b) **given an interface type (name) directly, inspect its members**.\r\n\r\n * If the suggestion in #6382 is implemented, we would get this for free (and it would also support\r\n`Get-Member -InputType System.Collections.Hashtable -View Interface -Name *dictionary*`); e.g.\r\n\r\n```powershell\r\n# WISHFUL THINKING\r\n# Note the -Input*Type* parameter name.\r\nPS> Get-Member -InputType System.Collections.IDictionary\r\n\r\n TypeName: System.Collections.IDictionary\r\n\r\n# Analogous to the above (with only ever one, non-type-name-prefixed entry in the Definition column)\r\n```\r\n\r\n* (c) given a concrete instance or type, **list just the interface _types_, not also their members**, via `-View InterfaceType`\r\n\r\n```powershell\r\n# WISHFUL THINKING: List [TypeInfo] instances for all interfaces implemented by the given instance / type:\r\nPS> @{} | Get-Member -View InterfaceType\r\n\r\nIsPublic IsSerial NameSpace Name Location BaseType\r\n-------- -------- --------- ---- -------- --------\r\nTrue False System.Collections IDictionary /Users/mklement/.powershell-PREVIEW/System.Private.CoreLib.dll \r\nTrue False System.Collections ICollection /Users/mklement/.powershell-PREVIEW/System.Private.CoreLib.dll \r\nTrue False System.Collections IEnumerable /Users/mklement/.powershell-PREVIEW/System.Private.CoreLib.dll \r\nTrue False System.Runtime.Serialization ISerializable /Users/mklement/.powershell-PREVIEW/System.Private.CoreLib.dll \r\nTrue False System.Runtime.Serialization IDeserializationCal… /Users/mklement/.powershell-PREVIEW/System.Private.CoreLib.dll \r\nTrue False System ICloneable /Users/mklement/.powershell-PREVIEW/System.Private.CoreLib.dll \r\n\r\n```\r\n\r\n\r\n**Motivation:**\r\n\r\n* Inspecting an interface's members helps especially script authors that define interface-typed parameters (see #13852), so they know what members they can rely upon when operating on a parameter value (though Intellisense in Visual Studio Code can also be a great help there).\r\n\r\n* Even outside of script authoring this feature can be a benefit, namely to users that use PowerShell's as a convenient playground for .NET types, including its convenient reflection features.\r\n\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2020-10-24T20:43:20Z","url":"https://github.com/PowerShell/PowerShell/issues/13865"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:be811f90-8389-d10a-d2ce-a97d9ea96fb7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB84:11FCD:8DC38:C7158:6AFDA9A6 |
| html-safe-nonce | e8b149edb878fb878686bb0a9fd0af8f33e4e59354bd7d8978ea8da78a4af1c6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjg0OjExRkNEOjhEQzM4OkM3MTU4OjZBRkRBOUE2IiwidmlzaXRvcl9pZCI6IjIxMTkyNjI5ODMwNjEwODg2NzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fae15a602d5cc558f85665186b5ef2afa9c4f3a072ae8dbaeb0b4d5c7635d5ea |
| hovercard-subject-tag | issue:728873022 |
| 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/13865/issue_layout |
| twitter:image | https://opengraph.githubassets.com/43ef28f988f3c5d08e693288ee9f324d03bf3a90987a5ba09e85a64deebcc6ce/PowerShell/PowerShell/issues/13865 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/43ef28f988f3c5d08e693288ee9f324d03bf3a90987a5ba09e85a64deebcc6ce/PowerShell/PowerShell/issues/13865 |
| og:image:alt | Summary of the new feature/enhancement As a user in general, but especially as a script author, I want to be able to: (a) given a concrete instance or type, inspect the .NET interfaces it implement... |
| 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 | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| 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 | 0ddf53eb35c87f1f8df13dbf75c3bdadbfc6e969 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width