Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enum Intellisense Display Attribute?

I want to do this:

enum Foo
{
    [Display="Item One"]
    ItemOne,
}

So that Intellisense will display it like in the attribute instead of the actual name.

I know it's possible, I've seen it before.

like image 819
Nobody Avatar asked Dec 04 '22 10:12

Nobody


1 Answers

Well you could provide XML documentation:

enum Foo
{
    /// <summary>Item One</summary>
    ItemOne
}

I'm not sure whether that's quite what you were thinking of, but here's an example of what it looks like in VS 2010:

IntelliSense with enum

Note that I'm assuming you mean from the code editor... if you mean within a property editor, that could be something entirely different, e.g. DisplayNameAttribute (although that's meant for properties, events or methods).

If you know an example of what you want within the framework, we may be able to help more.

like image 67
Jon Skeet Avatar answered Dec 16 '22 12:12

Jon Skeet