TypeName | SA1132DoNotCombineFields |
CheckId | SA1132 |
Category | Readability Rules |
📝 This rule is new for StyleCop Analyzers, and was not present in StyleCop Classic.
Two or more fields were declared in the same field declaration syntax.
A violation of this rule occurs when two fields are declared as part of the same field definition.
For example, the following code would produce a violation of this rule:
public class TypeName
{
private int field1,
field2; // SA1132
}
The following code would not produce any violations:
public class TypeName
{
private int field1;
private int field2;
}
To fix a violation of this rule, declare each field as part of its own field definition.
public class TypeName
{
private int field1,
#pragma warning disable SA1132 // Do not combine fields
field2;
#pragma warning restore SA1132 // Do not combine fields
}