Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


#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


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


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.


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

See Also

C# Preprocessor Directives

© 2015 Microsoft