Share via


Overview of Metadata

Metadata is used to describe runtime types (classes, interfaces, and value types), fields, and methods, as well as internal implementation and layout information that is used by the common language runtime (CLR) to JIT-compile Microsoft Intermediate Language (MSIL), load classes, execute code, and interoperate with the COM classic or native world. The metadata is included with every CLR component, and is available to the runtime, tools, and services.

All manipulation of metadata is performed through the metadata APIs, which insulate a client (tools and services) from the underlying data structures and enable a pluggable persistence format architecture that allows runtime binary representations, COM classic type libraries, and other formats to be transferred to or from memory transparently.

The metadata APIs include interfaces that emit (that is, generate) and import metadata. A client can emit or import metadata in the following ways:

  • Compilers and tools emit metadata by calling the "emit" APIs. Metadata is emitted during the compilation and linking process. RAD tools emit metadata as a part of building components or applications. The APIs write to and read from in-memory data structures. At save time, these in-memory structures are compressed and persisted in binary format into the target compilation unit (.obj file), executable file (.exe file), or standalone metadata binary file. When multiple compilation units are linked to form an EXE or DLL, the "emit" APIs provide a method used to merge the metadata sections from each compilation unit into a single integrated metadata binary file.

  • The loader and other runtime tools and services import metadata by calling the "import" APIs to obtain information about components so that tasks such as loading and activation can be completed.

In This Section

See Also

Other Resources

Unmanaged API Reference
Standard EMCA-335: Common Language Infrastructure (CLI)
ECMA C# and Common Language Infrastructure Standards