Visual-studio – “Folding” long sections of code in Visual Studio 2008

idepluginsvisual-studio-2008

I have lengthy functions in VB.NET (VS2008) and I'd like to shrink them down. I know about the #region directives, but they don't work inside functions.

I was wondering if anyone knew of any plugins for visual studio 2008 that would allow me to fold if statements, loops and try catch statements. I've found a couple of plugins for Visual Studio 2005 but none for Visual Studio 2008.

Best Answer

You may want to read Martin Fowler's book called Refactoring: Improving the Design of Existing Code, as well as Code Complete: 2nd Edition.

refactoring book http://ecx.images-amazon.com/images/I/21ZceZ5jBTL._SL160_PIsitb-sticker-arrow-dp,TopRight,12,-18_SH30_OU01_AA115_.jpgcode complete book

If you're having functions and subroutines that long, it means there are larger complexity forces at work that need refactoring.

Update:

I just finished the book Clean Code by "Uncle" Bob Martin, and I have to say that it belongs right next to the other two in the 'Must Read' category.

Clean Code