Show/Hide Toolbars

XSharp

Purpose

#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. In longer code files, it is convenient to be able to collapse or hide one or more regions so that you can focus on the part of the file that you are currently working on. The following example shows how to define a region:

#region MyClass definition
CLASS MyClass
  EXPORT Name as STRING
END CLASS
#endregion

Comments

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

A #region block cannot overlap with a #ifdef block or an #ifndef block. However, a #region block can be nested in a #ifdef or #ifndef block, and a #ifdef or #ifndef block can be nested in a #region block.
For now the compiler does not enforce this, but it will in the not too far future.

A #region and #endregion block may have optional comments after the #region and #endregion keyword. The compiler will ignore everything after the keyword until the end of the line