23 out of 45 rated this helpful - Rate this topic

#region (C# Reference)

#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. For example:


      #region MyClass definition
public class MyClass 
{
    static void Main() 
    {
    }
}
#endregion

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.

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.