14.3 Runtime Support

At runtime the core CLR services, such as serialization and remoting, inspect the custom and pseudocustom attributes to determine how to handle an instance of a type.

In the case of custom attributes, this is done by creating an instance of the attribute (invoking the relevant constructor call and property-set operations), then performing whatever steps are needed to determine how to handle an instance of the type.

In the case of pseudocustom attributes, this is done by inspecting the metadata directly and determining how to handle an instance of the type. Consequently, handling pseudocustom attributes is more efficient than handling custom attributes.

Note that none of these steps is initiated until a service or user program actually tries to access the attributes, so there is little runtime overhead unless required.



C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net