Collapse to Definitions with Outlining

Keyboard:  CTRL + M, CTRL + O
Menu:  Edit -> Outlining -> Collapse to Definitions
Command:  Edit.CollapsetoDefinitions
Versions:  2008,2010
Published:  3/18/2010
Code:  vstipEdit0032


One of the coolest features of Outlining is the Collapse to Definitions.  This feature will collapse the areas for all members.  So if you have code like this:



You can press CTRL + M, CTRL + O or go to Edit -> Outlining -> Collapse to Definitions on your Menu Bar to get this:


Comments (10)

  1. Jack says:

    Great skill, save me lots of time in the future

  2. Tony says:

    That's a useful feature, but it doesn't seem to work with ashx files.

  3. Txarlie says:

    The opposite process is very useful sometimes. Thus, if you need, you can "uncollapse" all definitions by clicking on CTRL + M + P. That is, use P instead of O.

  4. Tobi says:

    @Txarlie: your comment is more usefull… thanks

  5. Doug says:

    This feature is awesome and I loved in it 2010, but now in 2012 the behavior has changed and comment blocks that appear before a method now collapse as well making it annoying — you can't read a multi-line comment block above a method any longer with this feature.  Is there some reason this was changed or could there please be an option to bring back the previous behavior which left multi-line comments above a definition there?!


    // This is a comment for this method.

    // This method should be called when xyz happens.

    void DoFoo()



    In 2012 the two comments will collapse into an unreadable  /* … */ tag.

  6. zainnab says:

    Hey Doug 🙂

    In cases where things change betweeen versions like that the team will usually restore the old way in one of the updates.  I'm not sure where this is on the list of priorities so can't say when they will fix it but I'm pretty sure it is on the product backlog.


  7. Daniel says:

    I was looking for this feature in VS2013, but it simply worn't work (not even if I manually execute it with Outlining->Collapse… from menu)

  8. Fernando says:

    Same as @Daniel here.  It doesn't run on VS2013 + Update3

  9. fischgeek says:

    Having the same issue here with my 2013 installation. Hope it gets fixed soon!

  10. robert says:

    Collapse to definitions does work in VS2013 Update 3

    It does not work if you have "c# Outline 2013" installed and enabled

Skip to main content