CONTENTS
Obtaining a Type Reference Using typeof() .......................................................................................... 563
Obtaining a Type Reference Using System.Type.GetType().................................................................. 563
Building a Custom Metadata Viewer..............................................................................564
Reflecting on Methods.......................................................................................................................... 564
Reflecting on Fields and Properties...................................................................................................... 565
Reflecting on Implemented Interfaces.................................................................................................. 565
Displaying Various Odds and Ends ....................................................................................................... 566
Implementing Main()............................................................................................................................. 566
Reflecting on Generic Types................................................................................................................. 568
Reflecting on Method Parameters and Return Values.......................................................................... 568
Dynamically Loading Assemblies ..................................................................................569
Reflecting on Shared Assemblies ..................................................................................572
Understanding Late Binding ..........................................................................................574
The System.Activator Class .................................................................................................................. 574
Invoking Methods with No Parameters................................................................................................. 576
Invoking Methods with Parameters...................................................................................................... 577
Understanding the Role of .NET Attributes ....................................................................578
Attribute Consumers............................................................................................................................. 579
Applying Attributes in C# ...................................................................................................................... 579
C# Attribute Shorthand Notation........................................................................................................... 581
Specifying Constructor Parameters for Attributes................................................................................ 581
The Obsolete Attribute in Action........................................................................................................... 582
Building Custom Attributes ............................................................................................583
Applying Custom Attributes .................................................................................................................. 583
Named Property Syntax........................................................................................................................ 584
Restricting Attribute Usage................................................................................................................... 584
Assembly-Level Attributes.............................................................................................585
The Visual Studio AssemblyInfo.cs File ................................................................................................ 586
xxiv