rspec/rules/S3258/csharp/rule.adoc

42 lines
725 B
Plaintext

== Why is this an issue?
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[]