All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.plugins.csharp.S4201.html Maven / Gradle / Ivy

There is a newer version: 10.2.0.105762
Show newest version

Why is this an issue?

There’s no need to null test in conjunction with an is test. null is not an instance of anything, so a null check is redundant.

Noncompliant code example

if (x != null && x is MyClass) { ... }  // Noncompliant

if (x == null || !(x is MyClass)) { ... } // Noncompliant

Compliant solution

if (x is MyClass) { ... }

if (!(x is MyClass)) { ... }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy