Partilhar 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 API, which insulates a client (tools and services) from the underlying data structures and enables 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 API includes 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 API members 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 (.exe) file, or standalone metadata binary file. When multiple compilation units are linked to form an EXE or DLL, the "emit" API members provide a method 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" API members to obtain information about components so that tasks such as loading and activation can be completed.

In This Section

See Also

Concepts

Overview of Metadata

Metadata Interfaces

Metadata Global Static Functions

Metadata Enumerations

Metadata Structures

Metadata Unions

Other Resources

Standard EMCA-335: Common Language Infrastructure (CLI)

ECMA C# and Common Language Infrastructure Standards