CodeQL library for C#
codeql/csharp-all 5.4.8 (changelog, source)
Search

Predicate isConstantComparison

Holds if comparison operation co is constant with the Boolean value b. For example, the comparison x > x is constantly false in

int MaxWrong(int x, int y) => x > x ? x : y;

Import path

import semmle.code.csharp.commons.Constants
predicate isConstantComparison(ComparisonOperation co, boolean b)