The indicated operator is being used in a context (such as an if
or while
statement) where a
logical value (true
or false
) is expected.
This operator typically does not return a logical value. However, in rare cases
where a class overloads this operator to return a logical value, then Code
Analyzer returns this message erroneously. For more information overloading
operators, see “Implementing Operators for Your Class”.
Typically, Code Analyzer returns this message as the result of a bug or typographical error; therefore, you need to change the code. However if you know that Code Analyzer is wrong, suppress the message, as described in Adjust Code Analyzer Message Indicators and Messages.