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 e开发者_Python百科nums 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?
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
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.
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
精彩评论