Welcome to MSDN Blogs Sign in | Join | Help

Sara Ford's Weblog

My adventures embracing open source on CodePlex and at Microsoft

News

    • Did you know... All author proceeds go directly to sending Hurricane Katrina survivors to college.

      Microsoft Visual Studio Tips book

      Recent Entries

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.

Method foo() doesn't appear in intellisense

Of course, you can still complete the line above with foo(), and everything will compile successfully.

Technorati Tags: ,
Posted: Thursday, May 15, 2008 3:00 AM by saraford

Comments

Brian said:

I use this attribute for using dependency injection. On my singletons

# May 15, 2008 4:21 PM

Steven R said:

I'm trying to think of the practicality of this feature, and I just can't think of anyting off the top of my head.

So, my question is, would you know when it makes sense to use this attribute?  Or is this better suited for one of the .NET Framework folks?

# May 15, 2008 6:24 PM

Kyralessa said:

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?

# May 15, 2008 9:35 PM

Visual Studio Hacks said:

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 . Via

# May 16, 2008 8:08 AM

Pete M said:

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.

# May 19, 2008 8:27 AM

Ben said:

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.

# May 30, 2008 7:03 AM
New Comments to this post are disabled
Page view tracker