Did you know… You can mark methods and types as Hidden, so they don’t appear in Intellisense or in the Object Browser? - #216
Today’s tip is a continuation from yesterday’s tip which talked about how to hide or show hidden members and types in the Object Browser. So today’s tip is how to actually make something hidden or hidable.
In the System.ComponentModel namespace, there’s the EditorBrowseableAttribute class.
Going back to yesterday’s foo() and bar() methods, you’ll see in the below example how the foo() doesn’t appear in Intellisense, just like it doesn’t appear in the Object Browser.
Of course, you can still complete the line above with foo(), and everything will compile successfully.
Technorati Tags: VS2005Tip,VS2008Tip
Comments
Anonymous
May 15, 2008
I use this attribute for using dependency injection. On my singletonsAnonymous
May 15, 2008
The comment has been removedAnonymous
May 15, 2008
I second the question: What is this for? An example in the CLR I discovered recently is TreeView.Sorted, which works but never shows up in Intellisense. What's the point of having a property that doesn't show up in Intellisense? Is it supposed to be a super-secret advanced property or something?Anonymous
May 16, 2008
My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. Microsoft Downloads: Visual Studio Team System 2008 Capabilities White Papers . Symbols Package for Windows XP Service Pack 3 . ViaAnonymous
May 19, 2008
In response to StevenR & Kyralessa, Daniel Cazzulino demonstrates an elegant usage of this attribute in order to hide System.Object inherited members from your interfaces: http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx This is useful when Equals(), GetType(), GetHashCode(), etc obscures the one or two "important" members of your class or interface.Anonymous
May 29, 2008
Any idea how to tell Intellisense to hide deprecated members? This is on an assembly over which I have no control, so I can't add this Hidden attribute... unfortunately.