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

Predicate missedOfTypeOpportunity

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

Import path

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