Query module ForeachCapture

name
Capturing a foreach variable
description
Code that captures a ‘foreach’ variable and uses it outside the loop behaves differently in C# version 4 and C# version 5
kind
problem
problem.severity
recommendation
precision
medium
id
cs/captured-foreach-variable
tags
portability maintainability language-features external/cwe/cwe-758

Imports

Collections

Provides definitions related to the namespace System.Collections.

Generic

Provides definitions related to the namespace System.Collections.Generic.

LibraryTypeDataFlow

Provides classes and predicates for tracking data flow through library types.

csharp

The default C# QL library.

Predicates

Classes