Articles → CSHARP → Attribute In C#Attribute In C#In this article, we will discuss attributes in C#.What Is An Attribute? Attribute is a way to associate declarative information with types, methods and properties. But what is declarative information? Let me try to answer it in the next section.Declarative Information Declarative information tells the associated types, methods and properties what needs to be performed, but it does not tell about how it needs to be performed. Consider an example of the following HTML tag<b>text</b>Above tag tells the browser to display the text in bold, but it doesn’t provide any steps (or logic) on how to achieve it.Syntax [Attribute_Name] ElementExample [Obsolete] public int MyObseleteProperty { get; set; }In the above code, we are informing compiler to mark the method as obsolete but we are not providing any steps on how to achieve it.Posted By - Karan Gupta Posted On - Thursday, February 16, 2017 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
<b>text</b>
[Attribute_Name] Element
[Obsolete] public int MyObseleteProperty { get; set; }
Query/Feedback