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

Predicate missedSelectOpportunity

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

Import path

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