Juan Pablo Gomez
Juan Pablo Gomez

Reputation: 5534

How to add Intellisense description to an enum members c#

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

Upvotes: 17

Views: 6528

Answers (1)

User 12345678
User 12345678

Reputation: 7804

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

Upvotes: 31

Related Questions