April 2008
Intermediate to advanced
704 pages
17h 49m
English
Problem
You need to create a custom attribute.
Solution
Create a class that derives from the abstract (MustInherit) base class System.Attribute. Implement constructors, fields, and properties to allow users to configure the attribute. Apply the System. AttributeUsageAttribute attribute to your class to define the following:
Which program elements are valid targets of the attribute
Whether you can apply more than one instance of the attribute to a program element
Whether the attribute is inherited by derived types
How It Works
Attributes provide a mechanism for associating declarative information (metadata) with program elements. This metadata is contained in the compiled assembly, allowing programs to retrieve it ...
Read now
Unlock full access