简体   繁体   中英

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

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
} 

结果

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM