WHAT’S IN THIS CHAPTER?
- Using custom attributes
- Inspecting the metadata at runtime using reflection
- Building access points from classes that enable reflection
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
The wrox.com code downloads for this chapter are found at http://www.wrox.com/remtitle.cgi?isbn=1118314425 on the Download Code tab. The code for this chapter is divided into the following major examples:
MANIPULATING AND INSPECTING CODE AT RUNTIME
This chapter focuses on custom attributes and reflection. Custom attributes are mechanisms that enable you to associate custom metadata with program elements. This metadata is created at compile time and embedded in an assembly. Reflection is a generic term that describes the capability to inspect and manipulate program elements at runtime. For example, reflection allows you to do the following:
- Enumerate the members of a type
- Instantiate a new object
- Execute the members of an object
- Find out information about a type
- Find out information about an assembly
- Inspect the custom attributes applied to a type
- Create and compile a new assembly
This list represents a great deal of functionality and encompasses some of the most powerful and complex capabilities provided by the .NET Framework class library. Because one chapter does not have the space to cover all the capabilities of reflection, it focuses on those elements that you are likely to use most frequently. ...