← back to index

S1659 — Multiple variables should not be declared on the same line

Language: C#  |  Type: CODE_SMELL  |  Severity: Minor

Tags: convention

Why is this an issue?

Declaring multiple variable on one line is difficult to read.

Noncompliant code example

class MyClass
{
  private int a, b; // Noncompliant

  public void Method()
  {
    int c, d; // Noncompliant
  }
}

Compliant solution

class MyClass
{
  private int a;
  private int b;

  public void Method()
  {
    int c;
    int d;
  }
}