SA1109: BlockStatementsMustNotContainEmbeddedRegions

StyleCop

TypeName

BlockStatementsMustNotContainEmbeddedRegions

CheckId

SA1109

Category

Readability Rules

Cause

A C# statement contains a region tag between the declaration of the statement and the opening curly bracket of the statement.

Rule Description

A violation of this rule occurs when the code contains a region tag in between the declaration and the opening curly bracket. For example:

    if (x != y)

    #region

    {

    }

    #endregion

This will result in the body of the statement being hidden when the region is collapsed.

How to Fix Violations

To fix a violation of this rule, remove the region or move it outside of the statement.