48 lines
707 B
Plaintext
48 lines
707 B
Plaintext
include::../description.adoc[]
|
|
|
|
== How to fix it
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,csharp,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
class Person
|
|
{
|
|
private int age;
|
|
|
|
[Pure] // Noncompliant: The method makes a state change
|
|
void ConfigureAge(int age) =>
|
|
this.age = age;
|
|
}
|
|
----
|
|
|
|
|
|
==== Compliant solution
|
|
|
|
[source,csharp,diff-id=1,diff-type=compliant]
|
|
----
|
|
class Person
|
|
{
|
|
private int age;
|
|
|
|
void ConfigureAge(int age) =>
|
|
this.age = age;
|
|
}
|
|
----
|
|
|
|
include::../resources.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|