user65628
user65628

Reputation:

How to get Intellisense to display the meaning of an enum value

I'm wanting to know to get Intellisense in Visual Studio 2005 to display the meaning of individual enum values for a VB.NET project. This already happens for enums that are a part of the .NET library.

Is this possible? If so, how would I need to comment my enums to get this to happen?

Upvotes: 15

Views: 6206

Answers (3)

Fox
Fox

Reputation: 584

In case someone else finds this and has the same problem...

This doesn't work when you assing values like this, only the first summary will be shown.

''' <summary>
''' Overall description
''' </summary>
Public Enum Foo AS Integer
    ''' <summary>
    ''' Specific value description
    ''' </summary>
    First = 0
    ''' <summary>
    ''' Does not show up!
    ''' </summary>
    Second = 1
End Enum

Just add an empty row before every new summary and it works:

''' <summary>
''' Overall description
''' </summary>
Public Enum Foo AS Integer
    ''' <summary>
    ''' Specific value description
    ''' </summary>
    First = 0

    ''' <summary>
    ''' Does now show up!
    ''' </summary>
    Second = 1
End Enum

Upvotes: 0

jball
jball

Reputation: 25024

In VS 2008 simply use the standard XML commenting syntax. I assume (but have no way of checking) that it's the same in VS 2005?

    ''' <summary>
    ''' Overall description
    ''' </summary>
    Public Enum Foo AS Integer
        ''' <summary>
        ''' Specific value description
        ''' </summary>
        First,
        ''' <summary>
        ''' etc.
        ''' </summary>
        Second
    End Enum

Upvotes: 16

John Fisher
John Fisher

Reputation: 22727

In C#, you do it like this:

enum Test
{
    /// <summary>
    /// The first value.
    /// </summary>
    Val1,
    /// <summary>
    /// The second value
    /// </summary>
    Val2,
    /// <summary>
    /// The third value
    /// </summary>
    Val3
}

So, in VB you would just add the XML comment summary above the enum value.

Upvotes: 7

Related Questions