views:

224

answers:

4

Oftentimes I want to bring up a system class in a source view, so that I can browse the properties and methods exposed by the class. Below is the screenshot of what I mean:

Srting from metadata

Usually I do this by selecting the class name and pressing F12 (or right click>Go To Definition). However, if I haven't got it anywhere ready, i have type it up and then do Go To Definition. Most of the time I have to delete what I typed later on.

Is there a way to bring up this view without having to type the class name? The VS2010 Navigate To dialog doesn't support this.

EDIT: When I posted the question I didn't use any Visual Studio plugins. Now that I realised that I have full CodeRush license (thanks to StackOverflow promotion for users with 10K rep) I will accept answers that use CodeRush or Refactor!.

EDIT: At this stage I haven't really got anywhere with trying to answer this question. I am going to leave it open and let the bounty auto-award itself to Rory as he explained what's happening the best. In the meantime(schedule allowing) I will investigate doing this with DXCore as I think it should be possible.

+2  A: 

There is no way that I know of to do this in Visual Studio 2010. However, you can do this in ReSharper via the 'navigate to' menu. I suggest you try the 30 day trial from them, then if you really do need this then purchase it.

BeRecursive
+3  A: 

I was not aware of that new "Navigate To" feature, but I used to use Reflector for this sort of things. The pro version offers some integration with Visual Studio (Right clicking the method and selecting "Open In .NET Reflector"). It will open the reflector window and won't show the code in the VS itself. You can watch the demo that shows this feature and some others.
This is not the best answer that I'd expect but is a good option to know.

Matias
+7  A: 

The view you're looking at appears to have been built by some sort of analysis of the IL of the framework. Without knowing the type you intend to look at, no deconstruction can be done. Therefore I feel that, you are unlikely to find exactly what you have said you are looking for.

Allow me to suggest a few alternatives though.

Disclaimer: I work for DevExpress as a CodeRush Community Evangelist.

The Object Browser ([Ctrl+Alt+J]) This screen will load without attempting to show you any particular type, it will therefore be down to you to find the type in question. However all types are available and full search functionality is provided. once the type you're looking or is found, all members are listed and available.

Update: If you use the (Ctrl+K, Ctrl+R) shortcut to launch the object browser, then it will launch focused on the Search box. This is invaluable.

There are a number of CodeRush features which can prove useful when trying to locate code.

TabToNextReference ([Tab]) Whilst the caret is positioned within a type, strike the tab key and the next reference to that type will be located. More Details

References ToolWindow (Shift+F12) When activated the References ToolWindow will show you any references to the current type or member. This toolwindow can also be used to navigate said references. The References Toolwindow can be used in both on demand and Live mode. this allows you to have the window update as you navigate your code (via mouse or keyboard) and locate all references of any symbol the caret lands upon.

QuickNav (Ctrl+Shift+Q): This feature is closest in style to VS2010's NavigateTo feature. QuickNav will locate symbols matching whatever you type into it's filter box. This facility also supports Camel Case search. More details

QuickNav is also much more configurable than it's VS counterpart

Finally

Please also keep in mind that CodeRush is build upon the DXCore, a framework which allows users to create their own plugins for use alongside each other and CodeRush.

This framework has been repeatedly been leveraged by the community to add additional functionality. So even if you don't see any thing quite to your needs, consider suggesting something to the community by way of the forums or even contact me directly RoryB at DevExpress dot Com

I'm sure there's something we can do to help you out :)

Rory Becker
Thanks Rory for a great post. I do feel, however, that I should be able to find what I am looking for as all I want is "Go To Definition" functionality (which I assume is exposed by VS Extensibility) while supplying it with a full type name. Think QuickNav dialog that will index all referenced assemblies and performs going to a definition given a type.
Igor Zevaka
Sorry Igor, it looks like I misunderstood / misread your original request. It seemed you were looking to locate your type info without actually supplying the type. Now that I reread, it seems you're happy to supply this type, but you'd rather not have to delete it from your editor afterwards.
Rory Becker
A: 

A number of add-ins allow you to browse objects (though usually in an object-browser treeview manner rather than in a "header" file form - I believe Resharper, CodeRush and Visual Assist X all have variations on this theme).

However, one add-in to consider (as it's free) is the VS Productivity Power Tools. It adds a Solution Navigator window that gives a view onto your solution just like Solution Explorer, but (among other enhancements):

  • can search & filter the files listed, e.g. show only those files that are named Test.
  • can "expand" any file entry to show the types and members within it.
Jason Williams
Unfortunately the Solution Navigator doesn't really do referenced types that are not in the solution (i.e. `System.String`).
Igor Zevaka
Yeah. I'd love a "metadata view" (as posted in the question), for any class that I ask for help on. Maybe it's the C++ programmer in me trying to get back out, but I find that a "header file" is the most useful and readable summary of a class - much easier to grok than object browsers and MSDN documentation, because it's in the exact form that we read all day every day.
Jason Williams
I think we are in the same boat. There is nothing theoretically stopping this functionality. I guess my options are to hack into VS Extensibility or to do less StackOverflow, which is the primary use for this feature.
Igor Zevaka