Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 1.09 KB

SA1136.md

File metadata and controls

60 lines (46 loc) · 1.09 KB

SA1136

TypeName SA1136EnumValuesShouldBeOnSeparateLines
CheckId SA1136
Category Readability Rules

📝 This rule is new for StyleCop Analyzers, and was not present in StyleCop Classic.

Cause

Multiple enum values are placed on the same line of code.

Rule description

A violation of this rule occurs when two or more enum values are placed on the same line of code.

For example, the following code would produce a violation of this rule:

public enum ExampleEnum
{
    FirstValue, SecondValue
}

The following code would not produce any violations:

public enum ExampleEnum
{
    FirstValue,
    SecondValue
}

How to fix violations

To fix a violation of this rule, place each enum value on its own line.

How to suppress violations

#pragma warning disable SA1136 // Enum values should be on separate lines
public enum ExampleEnum
{
    FirstValue, SecondValue
}
#pragma warning restore SA1136 // Enum values should be on separate lines