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

Predicate missedSelectOpportunity

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

Import path

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