46 lines
759 B
Plaintext
46 lines
759 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
public int Example(int i)
|
|
{
|
|
return (int) (i + 42); // Noncompliant
|
|
}
|
|
|
|
public IEnumerable<int> ExampleCollection(IEnumerable<int> coll)
|
|
{
|
|
return coll.Reverse().OfType<int>(); // Noncompliant
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
public int Example(int i)
|
|
{
|
|
return i + 42;
|
|
}
|
|
|
|
public IEnumerable<int> ExampleCollection(IEnumerable<int> coll)
|
|
{
|
|
return coll.Reverse();
|
|
}
|
|
----
|
|
|
|
== Exceptions
|
|
|
|
Issues are not raised against C# 7.1 ``++default++`` literal.
|
|
|
|
----
|
|
bool b = (bool)default; // Doesn't raise an issue
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|