Search code examples
c#attributesfield-description

why we use description attribute for class property in c#


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.


Solution

  • 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).