December 2001
Intermediate to advanced
416 pages
8h 16m
English
Attributes serve as metadeclarative information. C# supports several predefined (sometimes called intrinsic) attributes. In addition, the programmer can define new attribute types. These can be retrieved and queried at runtime through type reflection. Both the intrinsic and user-defined attributes are classes, although their syntax appears text based. Before we look at how we can define our own attribute types, let's briefly review the intrinsic attributes.
The Conditional attribute enables us to define class methods that are conditionally invoked on the basis of whether an associated string is defined. (We cannot, however, place a Conditional attribute on data members or properties.) ...
Read now
Unlock full access