All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.plugins.csharp.S2292.html Maven / Gradle / Ivy

There is a newer version: 9.32.0.97167
Show newest version

Why is this an issue?

Trivial properties, which include no logic but setting and getting a backing field should be converted to auto-implemented properties, yielding cleaner and more readable code.

Noncompliant code example

public class Car
{
  private string _make;
  public string Make // Noncompliant
  {
    get { return _make; }
    set { _make = value; }
  }
}

Compliant solution

public class Car
{
  public string Make { get; set; }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy