Export (0) Print
Expand All
100 out of 123 rated this helpful - Rate this topic

#region

#region lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor.

#region name

where:

name
The name you want to give to the region, which will appear in the Visual Studio Code Editor.

Remarks

A #region block must be terminated with a #endregion directive.

A #region block cannot overlap with a #if block. However, a #region block can be nested in a #if block, and a #if block can be nested in a #region block.

Example

// preprocessor_region.cs
#region MyClass definition
public class MyClass 
{
   public static void Main() 
   {
   }
}
#endregion

See Also

C# Preprocessor Directives

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.