46 lines
616 B
Plaintext
46 lines
616 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,csharp]
|
|
----
|
|
public int PickNumber()
|
|
{
|
|
int i = 0;
|
|
int j = 0;
|
|
|
|
i = i++; // Noncompliant; i is still zero
|
|
|
|
return j++; // Noncompliant; 0 returned
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[source,csharp]
|
|
----
|
|
public int PickNumber()
|
|
{
|
|
int i = 0;
|
|
int j = 0;
|
|
|
|
i++;
|
|
return ++j;
|
|
}
|
|
----
|
|
|
|
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[]
|