1

Is there a difference between using the C# Description attribute and XML documentation comments (triple-slash comments)? When should I use either one?

Thanks.

/// <summary>
/// This is my class.
/// </summary>
public class MyClass
{
    /// <summary>
    /// This is my field.
    /// </summary>
    public int myField = 1;
}

vs.

[Description("This is my class.")]
public class MyClass
{
    [Description("This is my field.")]
    public int myField = 1;
}
Stout
  • 463
  • 8
  • 19
  • 1
    The answers [here](https://stackoverflow.com/questions/51666875/get-xml-documentation-comments) might help. – madreflection Sep 11 '20 at 17:04
  • @madreflection: Thank you. The question title was a bit different, hence I could not find it. It answers my question. Could you please post that in an Answer, that I may accept it? – Stout Sep 14 '20 at 17:20
  • 1
    In that case, it would be a duplicate, as it would be a link-only answer within Stack Overfow. It's because the title was different (and it was framed differently) that I didn't flag it as a duplicate from the start. If you have the ability to accept it as a duplicate, please do so. Thanks. – madreflection Sep 14 '20 at 17:27
  • 1
    Got it. Marked as a duplicate. Thank you for the help. – Stout Sep 14 '20 at 18:30

0 Answers0