Enable hiding object members from Format-List, select *, tab completion, etc. - by Andrey Anastasov

Status : 


Sign in
to vote
ID 777689 Comments
Status Active Workarounds
Type Suggestion Repros 0
Opened 1/28/2013 10:42:25 AM
Access Restriction Public


The functionality described in this request is targeted at snapin developers, not at end users. PowerShell 3.0 gives users access to class members which are explicit interface implementation, e.g:

interface IPrivatelyNamed {
   string PrivateName { get; }

class MyType : IPrivatelyNamed {
   // ...
   string IPrivatelyNamed.PrivateName {
      get { return _privateName; }

Traditional .Net languages treat IPrivatelyNamed.PrivateName as a private member of MyType. PowerShell 3.0 does the opposite, exposing such members to the end user without requiring upcast to the declaring interface. While this behavior has valid uses, there are valid uses to the opposite. Explicitly implemented interfaces have practical uses as private implementation, at least as far as the end user is concerned. As a result, what is a reasonably well hidden internal implementation in traditional .Net languages and in PowerShell 2.0, is highly user visible in PowerShell 3.0.

This is a request to provide ability to selectively hide such class members from the end user. For example, the snapin developer could mark the members that need hiding with specific .Net attribute or through elements in PS1XML.

This request is provoked by a practical issue in VMware PowerCLI which uses explicitly implemented interfaces as developer-level interface. This developer-level interface comes with compatibility guarantees that make it difficult to modify. On the other hand, PowerShell 3.0 displays the developer-level interface to end users, polluting user-visible namespaces.
Sign in to post a comment.