CHAPTER 1 THE PHILOSOPHY OF .NET
------------------------------------------------------MethodName: Add (06000003)
Flags
: [Public] [HideBySig] [ReuseSlot] (00000086)
RVA
: 0x00002090
ImplFlags : [IL] [Managed] (00000000)
CallCnvntn: [DEFAULT]
hasThis
ReturnType: I4
2 Arguments
Argument #1: I4
Argument #2: I4
2 Parameters
(1) ParamToken : (08000001) Name : x flags: [none] (00000000)
(2) ParamToken : (08000002) Name : y flags: [none] (00000000)
Metadata is used by numerous aspects of the .NET runtime environment, as well as by various
development tools. For example, the IntelliSense feature provided by tools such as Visual Studio is made
possible by reading an assembly’s metadata at design time. Metadata is also used by various objectbrowsing utilities, debugging tools, and the C# compiler itself. To be sure, metadata is the backbone of
numerous .NET technologies including Windows Communication Foundation (WCF), reflection, late
binding, and object serialization. Chapter 15 will formalize the role of .NET metadata.
The Role of the Assembly Manifest
Last but not least, remember that a .NET assembly also contains metadata that describes the assembly
itself (technically termed a manifest). Among other details, the manifest documents all external
assemblies required by the current assembly to function correctly, the assembly’s version number,
copyright information, and so forth. Like type metadata, it is always the job of the compiler to generate
the assembly’s manifest. Here are some relevant details of the manifest generated when compiling the
Calc.cs code file shown earlier in this chapter (assume we instructed the compiler to name our assembly
Calc.exe).
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.ver 4:0:0:0
}
.assembly Calc
{
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module Calc.exe
.imagebase 0x00400000
.subsystem 0x00000003
.file alignment 0x00000200
.corflags 0x00000001
In a nutshell, this manifest documents the set of external assemblies required by Calc.exe (via the
.assembly extern directive) as well as various characteristics of the assembly itself (e.g., version number,
module name). Chapter 14 will examine the usefulness of manifest data in much more detail.
14