0

i saw in some code that use Description attribute for class property and i couldn't find reason of behavior in c# codding

 public class sample
    {
        [Description("description1")]
        public string PropertyOnne{ get; set; }

     }

for readability of code we can use xml summary for even property and i didn't understand what is difference between summary and Description attribute in class level.

Aref Zamani
  • 2,023
  • 2
  • 20
  • 40

2 Answers2

2

This is for visual designers, they can display the description when referencing them.

Remark from the docs:

A visual designer can display the specified description when referencing the component member, such as in a Properties window. Call Description to access the value of this attribute.

Source: https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.descriptionattribute?view=netframework-4.7.2

Abbas
  • 14,186
  • 6
  • 41
  • 72
2

Simple words, you can consider below explanation

  • The tag is used to generate documentation in XML for your Project at Compile time, this is also used by the visual studio for its intellisense database

  • The Description attribute used by the designer in order to understand the text, mostly at the bottom of the property window(for reference).

vikram sahu
  • 161
  • 12