no-region-in-body
What it does
Section titled “What it does”Reports a #region inside a block (a method, accessor or lambda body, or any block in one). Regions belong between members. No fix.
Why it matters
Section titled “Why it matters”A region in a body splits one piece of logic with a fold that hides the middle of it. A body that needs sections is a body that should be split into methods.
To fix, extract the section into a method and delete the region.
Example
Section titled “Example”...namespace N { class Other { void M() {#region R#endregion...Configuration
Section titled “Configuration”csharp: lint: rules: no-region-in-body: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line no-region-in-body in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| StyleCop | SA1123 |
full |