Versions: 2005, 2008, 2010
Did you know you can create named Regions that can be used to organize your code? Let’s take a look at how to do it.
Creating Named Regions
In C++ you create regions by using “#pragma region” with label and “#pragma endregion” (case-specific):
For C# you can eliminate the “pragma” keyword and just use “#region” with label and “#endregion” (case-specific):
Visual Basic is just as easy as C# and uses a similar syntax of “#Region” with label and “#End Region” (not case-specific):
Value of Named Regions
The value of creating Regions is twofold. First, they travel with the code so are shared by all team members when using source control. Second, they become part of document outlining and can be collapsed or expanded to further organize you code: