161

In Visual Studio, is there a window which shows list of methods in the active class? A small window like the Solution Explorer would be great. In Eclipse, there is one.

Palec
  • 12,743
  • 8
  • 69
  • 138
Jack Kada
  • 24,474
  • 29
  • 82
  • 106
  • 2
    For those searching in the future - CodeMaid offers such a list and much more! http://www.codemaid.net/ – BenKoshy Jan 11 '18 at 03:20

20 Answers20

165

There's a drop down just above the code window:

alt text

It's called Navigation bar and contains three drop downs: first drop down contains project, second type and third members (methods).

You can use the shortcut Ctrl + F2 (move focus to the project drop down) and press Tab twice (move focus to the third drop down) to focus it, down arrow will expand the list.

Full size image

David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68
ChrisF
  • 134,786
  • 31
  • 255
  • 325
  • 26
    Do you know if there is any shortcut to open this? It's sa annoying to use mouse for this. – Mariusz Pawelski Oct 10 '11 at 10:21
  • @ChrisF it seems that I cant't see that window in vs2012. How to enable it? – ysrb Apr 12 '13 at 10:04
  • @ysrb - No idea. I'm still on VS2010 here. Given that this question was about VS2008 I'd suggest you ask a new question (link back to this one to show that it's not a duplicate). – ChrisF Apr 12 '13 at 10:10
  • 14
    Also looking for a shortcut to open this, and/or a permanently opened window or frame. – Xonatron May 09 '13 at 19:44
  • 1
    I need something like that, but that lists only the method in the currently open file, so I see only partial methods when working with partial class. – Didier A. Sep 18 '13 at 15:19
  • 2
    @MariuszPawelski see [visual-studio-keyboard-shortcut-for-method-name-combobox](http://stackoverflow.com/questions/1194908/visual-studio-keyboard-shortcut-for-method-name-combobox) – nawfal Jan 07 '14 at 07:15
  • It shows everything not only methods. Document Outline shows methods collectively but it has a critical bug which slows down as of version 17.4.1. – SHIN JaeGuk Nov 16 '22 at 15:25
53

I found how to turn the drop down on as shown in the first answer (@ChrisF):

Go to Options->Text Editor->(your language)

and tick "Navigation bar" in the display section.

40

Since Visual Studio 2012, you can view the outline ( fields and methods) in the solution explorer by expanding the node corresponding to your file .

mLar
  • 2,967
  • 2
  • 22
  • 23
  • 5
    I much prefer this option than the dropdown one, which is annoyingly sorted alphabetically (in my opinion). – dbernard Nov 14 '13 at 20:05
  • Note that if you have a `partial class` then *all members* are listed under that node, not just those only in that file. – Dai Jan 08 '17 at 00:43
  • 1
    Combined with 'Scope to this' (context menu) this is actually not so bad – Gerard Mar 30 '21 at 12:06
  • For me it stops at the file level in the solution explorer, there is nothing to expand there. – Zitrax Apr 02 '23 at 08:05
24

ReSharper has a 'ReSharper | Windows | File Structure' window, which is used for visualizing current code file structure.

sqeez3r
  • 495
  • 6
  • 16
24

Shortcut to Navigation Bar is Ctrl+F2. Takes you to the types dropdown first. Press tab to go to method dropdown, and then enter on a method to go to that one.

general03
  • 855
  • 1
  • 10
  • 33
kejster
  • 497
  • 5
  • 10
22

Resharper has the File Structure window which is very similar to eclipse outline view. Originally answered in:

Visual Studio 2012: List of all Methods in class

Resharper help: http://www.jetbrains.com/resharper/webhelp/Reference__Windows__File_Structure_Window.html

Screen shot of File Structure window

Community
  • 1
  • 1
Philip Pittle
  • 11,821
  • 8
  • 59
  • 123
  • CTRL - F12 brings up the go to member navigation window in Resharper. It lists all the methods in the class and gives you the option to search. – WoZoNe Oct 12 '17 at 14:48
  • 1
    CTRL - F11 shows the above Resharper window. This is exactly what I was looking for. – gattsbr Jun 27 '18 at 16:48
13

Despite it's an old question maybe this answer help you as helped me.

you can download codemaid extension from here : codemaid website

it has a lot of functionality that you may find in their website.

the one that is related to this question is code digging

Visualize and navigate through the contents of your C# and C++ files from a tree view hierarchy. Quickly switch between different sorting methods to get a better overview. Drag and drop to reorganize the code. See McCabe complexity scores and informative tool tips.

in other words it give you ability to see the methods and properties and also reorganize them just with drag and drop. it's my everyday use extension

Mohammad Hossein Amri
  • 1,842
  • 2
  • 23
  • 43
  • CodeMaid reimplements most of the built-in VS functionality and is an overkill and unpleasant to see duplicated menu items polluting the IDE. – Ivan G. Sep 13 '16 at 22:02
  • I don't think so, some useful functionalities like `ctrl+m+z`, `ctrl+m+space`, `ctrl+m+f`, `sort lines` ,`clean whole solution`, `collapse all in solution explorer` , `arrange methods with drag and drop`, `method and properties tree` are tools that you can only find in some tools like reshraper. – Mohammad Hossein Amri Sep 14 '16 at 07:25
  • 1
    I didn't mean it as an offence, but most of the "code clean-up" procedures mostly introduce holy wars of coding style which I don't care about. Product is first. I don't even care if there are spaces and tabs in one file, only productivity. – Ivan G. Sep 15 '16 at 08:37
  • The code outline (spade) is indeed helpful. It would be great if it keeps itself in synch with the currently active / selected member in the text editor. – Markus L Feb 06 '18 at 14:51
  • @MarkusL you may create a new issue here: https://github.com/codecadwallader/codemaid/labels/enhancement – Mohammad Hossein Amri Apr 10 '18 at 07:10
11

There is no direct equivalent to the Outline View in Eclipse. The closest thing I've found is the Class View, which lists all classes and their members/methods. There is a search box at the top to narrow the selection.

Ben Hoffstein
  • 102,129
  • 8
  • 104
  • 120
  • Since VS 2010 on C++ here, I prefer this answer because the drop-down which hides my code is annoying. Another more convenient shortcut to show Class View is `Ctrl + Shift + C`. – Jeff T. Apr 17 '18 at 02:53
7

In Visual Studio 2019, there is the "Go To Member" action located in Edit - Go To that is mapped by default to ALT+\. I think this was added in Visual Studio 2017.

Go To Member command

This is what pops up which provides the desired functionality and a couple of options:

Go to member popup

bernie
  • 9,820
  • 5
  • 62
  • 92
  • 1
    I'm not sure I understand what exactly you mean. Without typing at least one character, it doesn't display anything so I don't see how it may be used to list all members. – David Ferenczy Rogožan Jun 30 '21 at 02:54
  • This solution has that: https://stackoverflow.com/a/2819532/1030527 What I show is a way to jump to a member by name using only the keyboard. – bernie Jun 30 '21 at 09:45
6

In Visual Studio 2015, View > Other Windows > Resource View. The keyboard shortcut is Ctrl+Shift+E. I find this cleaner than Class View. With Class View Windows you can filter methods/attributes based on access modifier (private/protected/public) etc.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
  • 3
    While this does list the fields and methods of the class, it requires that you navigate to the required class in the first place. What the OP asked for was for *the current active class.* i.e. the one currently open in code view. If I have a 3000 line long class with 78 methods and 63 fields that I currently have open and wish to quickly navigate to a known method name, but do not recall it's location, having to navigate the namespace first is not better than Ctrl-F. – Draco18s no longer trusts SE May 26 '16 at 04:38
  • 1
    Thanks this is exactly what I was looking for! This is an incredibly helpful tool. – user1529413 Aug 13 '19 at 14:43
5

A nice clean way to do this is to use the command View.SynchronizeClassView by entering it into the Command Window (View > Other Windows > Command Window or Ctrl+Alt+A) but there's no way to do it automatically.

enter image description here

Additionally, you can:

  • pin your Class view window
  • collapse the top pane (listing all the classes)

And now it feels just like the Visual Assist's feature "List Methods in Current File" (which also list members btw).

David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68
Alexis Pautrot
  • 1,128
  • 1
  • 14
  • 18
  • 1
    Where d I find that `View.SynchronizeClassView`? I can only find the "normal" Class View in Visual Studio 2017. – user11909 Feb 06 '19 at 11:08
  • This is a command you enter in the Command Window. Unfortunately you can't set it to automatically synchronize the ClassView and have to manually do it every time. You can assign a shortcut, but this is still an unnecessary inconvenience. – mKay Mar 02 '19 at 12:26
4

At the top of your text editor, you should have a dropdown that lists all the methods, properties etc in the current type; and it's clickable (even if those members are defined in other files - in which case they're greyed out but you can still navigate with them).

Also, if you use the Class Explorer (Ctrl+Alt+C) to navigate your project, then you'll get a full overview of all your types. However, there doesn't appear to be a setting in Tools/Options that allows you to track the active type in that window (there is for the solution explorer) - perhaps a macro or addin is in order...

general03
  • 855
  • 1
  • 10
  • 33
Andras Zoltan
  • 41,961
  • 13
  • 104
  • 160
2

Microsoft doesn't feel like implementing this useful tool, but if by chance you can have Visual Assist, you have it in VAssistX > Tools > VA Outline. The plugin is not free though.

johan d
  • 2,798
  • 18
  • 26
1

In Visual Studio 2005 and 2008 you can try the Source Code Outliner Power Toy.

alt text http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=SourceCodeOutliner&DownloadId=3493

Nathan Taylor
  • 24,423
  • 19
  • 99
  • 156
1

Do you mean the class view window (View->Class View, or Ctrl+W,C)?

You also have the intellisence popup-window

general03
  • 855
  • 1
  • 10
  • 33
sagie
  • 2,998
  • 3
  • 22
  • 31
  • I don't think any of these two is useful. In the Class view, you have to locate your class first. To show intellisense you have to write a class name somewhere or even instantiate it. Other answers contain faster and easier to use solutions. – David Ferenczy Rogožan Dec 08 '15 at 16:05
1

With Visual Studio 2010

You choose Tools->Settings->Expert Settings

On the left-bottom corner, you will see the tab "Class View" right next tab "Solution Explorer"

In the top area of "Class View" layout, you will see the list of class name, enum, struct, ... In the bottom area of "Class View layout, you will see the list of member for these class, enum or struct

Chuan Ng
  • 41
  • 5
  • As already answered by sagie, Dawid Ferenczy already comments, "In the Class view, you have to locate your class first. To show intellisense you have to write a class name somewhere or even instantiate it. Other answers contain faster and easier to use solutions." – Draco18s no longer trusts SE May 26 '16 at 04:40
1

I have been using USysWare DPack since forever. It is very small and not intrusive so if all you want is a quick shortcut window showing list of methods of the current file you are using, it provides just that. Good thing is that the author is still active after more than 10 years just to keep providing the same features into latest VS release.

https://marketplace.visualstudio.com/items?itemName=SergeyM.DPack-16348

After installation, just use Alt + M to bring up the method list window. I prefer to show all members instead, but it's up to you.

tia
  • 9,518
  • 1
  • 30
  • 44
-1

My best way to do this is, that i open the Code Definition Window, under View -> Code Definition Window or press Ctrl + W,D .

And then i got it floated and i have the definitions of methods in separate windows.

Regards

general03
  • 855
  • 1
  • 10
  • 33
Marko Leben
  • 21
  • 1
  • 5
  • How does it answer OP's question? He doesn't need definitions at all, just a list of class' members. To see a definition, you usually can just double-click a method in such list. – David Ferenczy Rogožan Dec 08 '15 at 16:10
-1

In VS 2012, just go to View > Class View...then you get the Class View GUI in the main tab area. Now, drag this over to the side dock and you have the exact same layout as you would in Eclipse.

-e

heregear
  • 67
  • 2
  • This is something different. It doesn't show members of the current class (class opened in an editor). You have to locate it manually. It's better to use the Solution explorer (expand file and class under it), because you can sync it with the current file. – David Ferenczy Rogožan Dec 08 '15 at 16:16
-4

grep -i " sub " filename.vb > methods.txt grep -i " function " filename.vb >> methods.txt

John Reichert
  • 415
  • 3
  • 12
  • Please explain how this provides an answer the question. – AdrianHHH Mar 11 '15 at 21:40
  • It answers the question because that solution provides a list of all subs and functions within a vb class. – John Reichert Mar 27 '15 at 17:53
  • He didn't want a list of methods in a class. He needed a window in Visual Studio with a list of methods in the **active** class. He also referenced the same thing in Eclipse. It's obvious that your answer is about something completely different. – David Ferenczy Rogožan Dec 08 '15 at 16:19