| layout | page |
|---|---|
| title | CC0007 |
| tagline | IfReturnTrueAnalyzer |
|TypeName|IfReturnTrueAnalyzer | |Check Id | CC0007 | |Category | Usage | |Severity | Warning |
Using an if/else to return true/false depending on the condition isn't useful, as the condition is already a boolean it can be returned directly.
{% highlight csharp %} bool something = true;
if (something) { return true; } else { return false; } {% endhighlight %}
A code fix will be presented to you that will transform the code:
{% highlight csharp %} bool something = true;
return something; {% endhighlight %}

None
TBD