DownloadObjectReflector.Net source code from CodePlex
Introduction
Which developer doesn't use Visual Studio Watcher and browse properties and fields values to debug his application? I think the response is No one.
However, imagine that you have not visual studio installed and something is going wrong with your application. Logging will be the solution of course, but how much data will application logs? Can you log all properties and fields values of all your objects? The response is definitively no.
ObjectReflector.Net can be the way for debugging applications at the user's desktops side.
Here a screen shot of what you can browse with ObjectReflector.Net :
Using the code
Using ObjectReflector.Net requires a single line of code. Begin by adding a reference to ObjectReflector.Dll, drag the ucBrowser from your Visual Studio toolbox to a form and add this line of c# in your code :
myBrowser.DataSource = this;
The left panel of the browser control allows enabling/disabling some options :
- Show NonPublic members : Checking this option will show all properties and fields including private and protected ones.
- Show Static members : Static properties and fields are shown/hidden depeding on the checkstate of the checkbox.
- Sort memeber by name : If checked, properties and fields are sorted by name before they are displayed in the treeview.
History
- 4/6/2007: ObjectReflector.Net article submitted.
Conclusion
Reflection is one of most powerfull features in the .Net framework. ObjectReflector.Net is a good sample i hope for those who don't discover reflection yet.
Regards,
Hayder Marzouk