Using .NET Custom Attributes
.NET framework assemblies are self-describing entities. They contain intermediate code that is compiled to native
machine instructions when the assembly is loaded. More than that, assemblies contain a wealth of information about
that code. The compiler emits this descriptive information, or metadata, into the assembly as it processes the source
code. In other programming environments, there is no way to access metadata once your code is compiled; the
information is lost during the compilation process. On the .NET platform, however, you have the ability to access
metadata using runtime reflection services.
The .NET framework gives you the ability to extend the metadata emitted by the compiler with your own descriptive
attributes. These customized attributes are somewhat analogous to language keywords, and are stored with the
other metadata in the assembly.
Declaring custom attributes
Using custom attributes
Custom attributes and interfaces
Dostları ilə paylaş: