The Common Language Runtime (CLR) provides a runtime environment that manages the execution of code and provides services such as security, versioning, and garbage collection. Metadata about our programs is generated during compilation. The runtime environment uses this metadata to locate and load classes, lay out objects in memory, and so on.
When we build our programs or components, both metadata and code are stored in self-contained units called assemblies. An assembly stores information about the components and resources against which it is compiled, as well as the types defined within it. The CLR accesses this information to guarantee that the application has the correct versions of its dependencies. We can access this metadata information as well.
The primary focus of this chapter is runtime access to the metadata information available through the CLR. We begin by looking at the Assembly class. From there we turn to two programming topics:
Introducing custom metadata in the form of Attribute classes
We conclude this chapter with a brief look at the machine-independent intermediate language (IL) representation of not just C# but all .NET languages and the ildasm tool for exploring the assembly metadata and code.
18.189.178.237