In the previous recipes we saw how to extend existing attributes to suit our needs. However, there are situations where you don't have an existing attribute to extend. In such cases, you will have to create your own attribute. In this recipe we will look at creating custom attributes. Our attribute will help you to keep track of bugs fixed within a class. It can be used to tag the class itself or methods within the class.
A custom attribute is a class extending from
System.Attribute. However, its behavior is quite different from a class. And to make it to work as an attribute, extra steps such as creating another class that can process the attribute are required.