Metadata
Source code consists of some constructs that are procedural in nature and others that are declarative in nature. An example of a procedural construct is:
someObject.SomeMember = 5
This is procedural because it compiles into executable code that
performs an action at runtime. Namely, it assigns the value
5
to the SomeMember member of the someObject
object.
In contrast, here is a declarative construct:
Dim someObject As SomeClass
This is declarative because it doesn’t perform an action. It states that the symbol someObject is a variable that holds a reference to an object of type SomeClass.
In the past, declarative information typically was used only by the
compiler and did not compile directly into the executable. In the
CLR, however, declarative information is everything! The CLR uses
type and signature information to ensure that memory is always
referenced in a safe way. The JIT compiler uses type and signature
information to resolve method calls to the appropriate target code at
JIT compile time. The only way for this to work is for this
declarative information to be included alongside its associated
procedural information. Compilers that target the CLR therefore store
both procedural and declarative information in the resulting
.exe
or .dll
file. The
procedural information is stored as IL, and the declarative
information is stored as metadata. Metadata is
just the CLI’s name for declarative information.
The CLI has a mechanism that allows programmers to include arbitrary ...
Get Programming Visual Basic .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.