Metadata is machine-readable information about a resource, or “data about data.” Such information might include details on content, format, size, or other characteristics of a data source. In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information.
In order for two systems, components, or objects to interoperate with one another, at least one must know something about the other. In COM, this “something” is an interface specification, which is implemented by a component provider and used by its consumers. The interface specification contains method prototypes with full signatures, including the type definitions for all parameters and returns types.
Only C/C++ developers were able to readily modify or use Interface Definition Language (IDL) type definitions—not so for VB or other developers, and more importantly, not for tools or middleware. So Microsoft invented something other than IDL that everyone could use, called a type library. In COM, type libraries allow a development environment or tool to read, reverse engineer, and create wrapper classes that are most appropriate and convenient for the target developer. Type libraries also allow runtime engines, such as the VB, COM, MTS, or COM+ runtime, to inspect types at runtime and provide the necessary plumbing or intermediary support for applications to use them.
Type libraries are extremely rich in COM, but many developers criticize them for their lack of standardization. The .NET team invented a new mechanism for capturing type information. Instead of using the term “type library,” we call such type information metadata in .NET
Key Benefits Of Metadata
- It reduces the need for IDL/header files and facilitates .NET to define itself in an automated and language-neutral way
- Metadata consists of self-describing files, assemblies, and common language runtime modules that can easily talk to the OS and don’t even need registration
- Special metadata known as attributes are declared by .NET and can control program behavior at execution
- Metadata offers detailed data regarding compile code in another language and hence supports language interoperability
- It is feasible to make a class instance in any language barring the need for a customized interoperability code
Metadata’s Usage By .NET
Metadata is used in .NET by
- Classloader for finding load .NET classes
- CLR for runtime features like security enforcement, authentication, memory layout, and implementation
- Just in Time compilers for compilation of IL code
- Debuggers, object browsers, profilers for integration support
Wrapping It Up
Since a module’s metadata comprises of all that you need for interaction with another module and information regarding modules, types, and assemblies, it is of great help for .NET application development services. The binary information that metadata offers includes plenty of important characteristics that help .NET components – the compilers, runtime, tools, work at their best.