All rules
IDE0080Unnecessary code rules (expression-level preferences)
Remove unnecessary suppression operator
Remove unnecessary suppression operator
Microsoft docsDescription
This rule flags an unnecessary suppression or null-forgiving operator. The operator is unnecessary when it's used in a context where it has no effect. Use of the suppression operator, for example, x!, declares that the expression x of a reference type isn't null. However, when used in a context of another operator, for example, the is operator in o !is string, it has no effect and can be removed.
Example
// Code with violations
if (o !is string) { }
// Potential fixes:
// 1.
if (o is not string) { }
// 2.
if (!(o is string)) { }
// 3.
if (o is string) { }Your vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0