Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding + collapsing tree lists to large comment blocks - C# code in Visual Studio 2008

I am working on C# programming assignment for college. Part of my final for the class. The prof gave us a program, that works, but is very poorly written. We have to clean up the code and add our own flair to it, but we have to do so with the original code, so that the prof can follow what we changed where.

Many of the methods have large chunks of redundant code that could be thrown into another method, once, then called on when needed.

I am commenting it all out, but it it easily takes up 80% of form.cs.

This leads me to my question:

Is there an easy way to add the plus sign drop downs so that I can collapse all the large comment blocks.

I am using MS Visual Studio 2008 Pro.

Thank you in advance for your help.

like image 743
subcan Avatar asked Jan 21 '23 22:01

subcan


2 Answers

Use regions.

#region

// Block you want to expand/collapse

#endregion
like image 61
Brandon Avatar answered Jan 23 '23 13:01

Brandon


You could add regions:

#region Commented out Method
//
//
//
#endregion

but I also think that if you use the

 /* */ 

commenting notation, VS 2008 will automatically add the collapsible control to the sidebar of your code. I don't have VS 2008 currently to test that out but VS 2010 does that.

like image 43
Dave White Avatar answered Jan 23 '23 13:01

Dave White