rspec/rules/S3258/csharp/rule.adoc
2022-02-04 16:28:24 +00:00

40 lines
697 B
Plaintext

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
[source,csharp]
----
private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
----
== Compliant Solution
[source,csharp]
----
public int MyProperty { get; set; }
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]