Reflection Notes

I've been doing quite a lot of work with C# reflection recently. Reflection is nifty stuff. It's cool to have code that can inspect itself, execute itself dynamically.

I've been using reflection to create applications that use "plug-ins". For example, the user might have a management GUI that allows them to select one of several similar but not identical assemblies. The GUI can then examine the assembly to verify that it supports and if it is can display information about the assembly within the context of the GUI.

The user can then use the GUI to execute various methods in the selected assembly.

As I've written several apps like this in the past 6 months of so and have to keep going back over my code to remember the exact syntax for (example) getting a list of class constructors using reflection. To make things easier for myself, I've gathered together a list of common reflection operations, here: http://robot.jlion.com/reflection-odds-and-ends/

Be the first to comment

Leave a Reply

Your email address will not be published.


*