Summary

An attribute is the extra information that can be attached to entities at the time of their declaration. Attributes are derived from the System.Attribute class. There are two kinds of attributes, predefined and custom attributes.

Custom attributes are attribute classes that are derived from the System.Attribute class. Attribute classes can have two kinds of parameters, positional and named parameters.

An attribute instance is an instance of the attribute class. It is initialized with the named and positional arguments. Reflection enables you to query code elements for information at runtime. The key method used here is the GetCustomAttributes method present in the System.Reflection namespace.

The AttributeUsage reserved attribute aims ...

Get Special Edition Using C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.