mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C#: Add extractor support for list- and slice patterns.
This commit is contained in:
@@ -79,6 +79,19 @@ namespace Semmle.Util
|
||||
a(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the action <paramref name="a"/> to each item and its index in this collection.
|
||||
/// </summary>
|
||||
public static void ForEach<T>(this IEnumerable<T> items, Action<T, int> a)
|
||||
{
|
||||
var i = 0;
|
||||
foreach (var item in items)
|
||||
{
|
||||
a(item, i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forces enumeration of this collection and discards the result.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user