Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.07 KB

SA1123.md

File metadata and controls

39 lines (29 loc) · 1.07 KB

SA1123

TypeName SA1123DoNotPlaceRegionsWithinElements
CheckId SA1123
Category Readability Rules

Cause

The C# code contains a region within the body of a code element.

Rule description

A violation of this rule occurs whenever a region is placed within the body of a code element. In many editors, including Visual Studio, the region will appear collapsed by default, hiding the code within the region. It is generally a bad practice to hide code within the body of an element, as this can lead to bad decisions as the code is maintained over time.

How to fix violations

To fix a violation of this rule, remove the region from the code.

How to suppress violations

[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1123:DoNotPlaceRegionsWithinElements", Justification = "Reviewed.")]
#pragma warning disable SA1123 // DoNotPlaceRegionsWithinElements
#pragma warning restore SA1123 // DoNotPlaceRegionsWithinElements