You can add declarative information to a program by using an attribute.
An attribute defines additional information that is associated with a class, structure, method, and so on.
An attribute is supported by a class that inherits System.Attribute.
All attribute classes must be subclasses of System.Attribute.
This built-in attribute AttributeUsage specifies the types of items to which the attribute can be applied.
using System.Diagnostics;
class MainClass
{
[Conditional("DEBUG")]
public void Validate()
{
}
}
C# defines three built-in attributes:
AttributeUsage,
Conditional,
Obsolete.