Metadata

Closely tied to MSIL is metadata. Metadata isn't a set of instructions like MSIL. Rather, it is information that describes the compiled code. It is stored in an assembly with MSIL to make one logical unit.

Here is a sampling of the information that metadata contains:

  • Full assembly name (simple name, version, public key, and culture)

  • Referenced assemblies

  • Visibility, inherited class, and implemented interfaces of each defined class

  • Information about class members such as methods, fields, and properties

Metadata allows .NET assemblies to be self-describing. This means that an assembly contains enough information to be closely inspected by other assemblies. There are unmanaged and managed APIs to view an assembly's metadata.

One other interesting benefit of metadata is that it allows the creation of custom attributes. A custom attribute allows you to store special information in an assembly. For instance, if your organization wants to store the author of an assembly in metadata, you can define an “AuthorAttribute.” Then, you can simply look in assemblies for this attribute when you want to find out who wrote the assembly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.208.183