Visual Studio - Hop to object in Object Browser?

Posted on 2011-10-28
Medium Priority
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
  • 2

Expert Comment

ID: 37048617
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

Jacques Bourgeois (James Burger) earned 1000 total points
ID: 37048745
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(https://connect.microsoft.com/VisualStudio/feedback/details/501303/find-all-references-go-to-definition-do-not-work-across-vb-c-in-same-solution). 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.


Expert Comment

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

Author Closing Comment

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


Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

840 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