mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
QL code and tests for C#/C++/JavaScript.
This commit is contained in:
22
csharp/ql/src/Linq/BadMultipleIteration.cs
Normal file
22
csharp/ql/src/Linq/BadMultipleIteration.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
class BadMultipleIteration
|
||||
{
|
||||
private static int count = 1;
|
||||
|
||||
private static IEnumerable<int> NonRepeatable()
|
||||
{
|
||||
for (; count <= 3; count++)
|
||||
{
|
||||
yield return count;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
IEnumerable<int> nr = NonRepeatable();
|
||||
foreach (int i in nr)
|
||||
Console.WriteLine(i);
|
||||
|
||||
foreach (int i in nr)
|
||||
Console.WriteLine(i);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user