Visual Studio - Hop to object in Object Browser?

Posted on 2011-10-28
Last Modified: 2012-05-12
Take a look at Image 1.  

1) If I hit F12, Visual Studio takes me to the definition of the Directory class.  
2) From there, I can see that Directory lives in the System.IO namespace in the mscorlib.dll assembly.  
3) I can then open the Object Browser, open mscorlib.dll, and find the System.IO.Directory class (Image 2).  

There has to be an easier way to do it.
Question by:jdana
    LVL 9

    Expert Comment

    Which version are you using ? Because I have VS 2008 and pressing F12 on IO.Directory brings me to the Object Explorer pointed on System.IO.Directory
    LVL 40

    Accepted Solution

    F12 does the "right" job in VB, but not in C#.

    The role of F12 is "Go to definition".

    In VB, if you do that on one of your own methods, it brings you to the code. Very nice. If you do it on something from the framework, it opens the Object Browser on the selected entry, giving you useful information and the possibility of hitting F1 to get more information. Very nice.

    In C#, if you do that on one of your own methods, it brings you to the code. Very nice. If you do it on something from the framework, it brings you to the source code of the framework, an absolute piece of useless information for most programmers. What most programmers want to know, even advanced programmers, is the context in which the class/property/method/whathever is defined and how to use it, not how it is implemented.

    That is one of the many reasons why, as an advanced programmer, I prefer VB over C#. Not because of the language, but because of the tools. The C# editor should be put to scrap.

    I understand your "frustation" jdana, and I suspect that you are a lucky VB programmer djon2003.

    This issue is a problem recognized by Microsoft, but their answer to the problem is one that points to lazyness on the part of the C# editor programmers: we *are* looking at ways to change this in the future, but the work required is very substantial( This is also probably why the VB editor indent everything very efficiently, while you have to spend time correcting the indentation in C#. This is also probably why the VB editor automatically generates the many different end constructs such as End If, Next, End Select and a few others, while C# is unable to automatically type the universal } they use for everything. This would require substantial work to create a tool that is as efficient as the VB editor, but for which we pay a substantial amount of money.

    Both languages ends up doing the same thing in the framework. None is better than the other. You might like the syntax of one better than the other, this is only a question of taste. But when you compare the editors, C# has a long way to go before being a tool as efficient as the VB editor.

    And the Go To Definition (F12) way of working is one of those differences that, unfortunately, *might* be improved in the future of the C# editor.

    Unfortunately, as far as I understand the answers Microsoft gives to that "problem", I do not think there is a solution at this point.

    LVL 9

    Expert Comment

    Right JamesBurger, I mostly program in VB. And effectively, it reminds me something when I used C# projects.

    Author Closing Comment

    Thanks for the thorough response, James.  I appreciate it, as always.


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now