rspec/rules/S3258/csharp/rule.adoc

20 lines
410 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
Unnecessarily verbose type declarations make it harder to read the code, and should be simplified to auto-property declarations when the getters and setters contain no logic other than a simple get/set.
== Noncompliant Code Example
----
private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
----
== Compliant Solution
----
public int MyProperty { get; set; }
----