Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Intellisense description to an enum members c#

Tags:

c#

enums

I have this enum:

/// <summary>
/// Accoun types enumeration
/// </summary>
public enum AcoountTypeTransaction
{
    [Description("Account type debit")]
    Debit = 0,
    [Description("Account type Credit")]
    Credit = 1
} 

I want to show descriptions on my intellisense, this is only a sample, i have many enums that must be explained. There is a way to do this

like image 889
Juan Pablo Gomez Avatar asked Oct 23 '13 20:10

Juan Pablo Gomez


1 Answers

Using XML document comments In the same manner as you would for the enumeration declaration itself like this.

/// <summary>
/// Account types enumeration
/// </summary>
public enum AcoountTypeTransaction
{
    /// <summary>
    /// This is the Debug  constant.
    /// </summary>
    [Description("Account type debit")]
    Debit = 0,
    /// <summary>
    /// This is the Credit constant.
    /// </summary>
    [Description("Account type Credit")]
    Credit = 1
} 

Result

like image 113
User 12345678 Avatar answered Nov 14 '22 03:11

User 12345678