Click here to Skip to main content
15,900,108 members
Articles / Programming Languages / C#
Article

Browsing objects using ObjectReflector.Net

Rate me:
Please Sign up or sign in to vote.
2.41/5 (5 votes)
6 Apr 20071 min read 17K   16   3
Browse any object using ObjectReflector.Net at runtime

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 :

Screenshot - ObjectReflector.jpg

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; //This line will allow you to browse the form it self

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

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
France France
MCSD Asp.Net certified developer

Comments and Discussions

 
GeneralCha7ata Pin
Ammar Ben Hadj Amor24-Apr-07 5:09
professionalAmmar Ben Hadj Amor24-Apr-07 5:09 
GeneralTypo Pin
sadavoya17-Apr-07 10:48
sadavoya17-Apr-07 10:48 
GeneralRe: Typo Pin
Hayder Marzouk17-Apr-07 10:55
Hayder Marzouk17-Apr-07 10:55 
Any witch from the wiches wich are in the "whitch" article.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.