Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

49 lines
868 B
Plaintext

== Why is this an issue?
The output of an ``++as++`` cast will be null if the input to the cast cannot safely be cast to the desired type. So it makes sense that after such a cast you would null-check the output. But it doesn't make sense to check the input.
=== Noncompliant code example
[source,csharp]
----
void DoTheThing(Toy toy)
{
Ball ball = toy as Ball;
if (toy != null) // Noncompliant
{
//...
}
}
----
=== Compliant solution
[source,csharp]
----
void DoTheThing(Toy toy)
{
Ball ball = toy as Ball;
if (ball != null)
{
//...
}
}
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
=== on 18 Jan 2016, 11:33:22 Ann Campbell wrote:
http://www.viva64.com/en/b/0363/#ID0EVHBI
=== on 8 Feb 2016, 13:40:13 Ann Campbell wrote:
subsumed by RSPEC-2583
endif::env-github,rspecator-view[]