Chad Harrison
Chad Harrison

Reputation: 2858

Is there a way to collapse groups of procedures?

I have a block of related sub routines I would like to "group" together within class to make navigating a littel easier. When I say group, I mean achieve the same functionality of being able collapse and expand a block of code as would with single procedure or class. Two alternative ways I can think to accomplish this is either use a partial class for those procedures or use namespace. I just wanted to see if VS for VB.Net had another way to be able group and collapse blocks of procedures. Thanks.

Upvotes: 0

Views: 232

Answers (3)

Venture Free
Venture Free

Reputation: 132

In VS 2005 at least you can use:

#Region "NameOfRegion"
    ' Methods go here
#End Region

That will allow you to collapse the region just like any other block of code within VS.

Upvotes: 5

Jay
Jay

Reputation: 6017

You can use a region

#Region "MathFunctions"
    ' Insert code for the Math functions here.
#End Region

Region information

Upvotes: 1

Tejs
Tejs

Reputation: 41246

Yes, you can use the region directive:

 #region Some Idenfifier

 ... Code ...

 #endregion

You can then collapse or expand the entire region to show the code contained.

Upvotes: 2

Related Questions