TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C# Coding Standard
Search

Rule:  6@112Checked automatically with code checker

Synopsis:Do not make explicit comparisons to true or false
Language:C#
Severity Level:9
Category:Control flow


Description:

It is usually bad style to compare a bool-type expression to true or false.

Example:

while (condition == false)	// wrong; bad style
while (condition != true)	// also wrong
while (((condition == true) == true) == true)	// where do you stop?
while (condition)	        // OK