What is an attribute in C#?
Experience Level: Junior
- In C#, an attribute is like a tag using which you can add additional information to a class or method.
- The attribute is applied to a class or method by writing the attribute name into the square brackets before the class or method definition.
- In the example below you can see how the attribute
Testis applied to the class
Obsoleteis applied to the method