次の方法で共有


Mark Methods and Types as Hidden from IntelliSense and the Object Browser

Versions:  2008,2010
Published:  9/6/2010
Code:  vstipTool0088

 

Are you thinking about developing for Windows Phone 7?  Then visit the Windows Phone Developer Portal today!

 

Namespace

When you make assemblies for others to use there may be times that you want to have hidden methods, properties, and other things.  To make an item hidden you use the System.ComponentModel namespace:

C#

image

 

VB

image

 

 

 

 

Hiding

To hide a property or method you use the "EditorBrowsable(EditorBrowsableState.Never)" attribute:

C#

image

 

VB

image 

 

 

 

Use

Testing this is pretty interesting.  You have to use the assembly externally as hiding is meant to hinder external users not the creator of the assembly.  Just making a reference to another project isn't enough you actually have to go to the Brose tab and set a reference to the external assembly that is created:

image

 

 

 

 

 

Result

When you test it the result should be fairly predictable:

C#

image

 

VB

image