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

Predicate missedOfTypeOpportunity

Holds if foreach statement fes can be converted to an .OfType() call. That is, the loop variable is accessed only in the first statement of the block, the access is a cast with the as operator, and the first statement is a local variable declaration statement s.

Import path

import Linq.Helpers
predicate missedOfTypeOpportunity(ForeachStmtEnumerable fes, LocalVariableDeclStmt s)