Getting started with C# reflection is easy enough—with just a few lines of code, you can pluck runtime details from objects. This strategy includes determining the methods supported by a given object. You can also discover details about an inheritance hierarchy.
The real power of reflections is seen when you want to use binary code, such as when you have a prepackaged assembly. Reflection enables you to determine the types in the assembly, as well as the method names and parameters. Using all this information, you can create and activate an object based on the discovered assembly specifications. At this point, you can invoke the discovered methods on the newly activated object.
I wrote the code for this article using the freely downloadable Microsoft Visual C# 2008 Express Edition. I like this IDE because it provides very powerful and complete wizards. In addition, the code-completion feature is comprehensive—with the size of modern APIs, code completion is now a mandatory element for effective programming. Aside from all this, the Microsoft Visual C# 2008 Express Edition package includes a handy command-line utility called ildasm.exe. This tool is useful for any assembly-based reflection coding because it allows you to peek inside an assembly and look at the methods, parameters, and so on. Clearly, the latter facility is useful for verifying (during test) any reflection-based code.