You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/Infrastructure/Extensions/ForeachExtensions.cs

18 lines
469 B

using System.Collections.Generic;
namespace Infrastructure.Extensions
{
public static class ForeachExtensions
{
public static List<(int i, TItem value)> Each<TItem>(this IEnumerable<TItem> items)
{
var result = new List<(int i, TItem value)>();
var index = 0;
foreach (var item in items)
{
result.Add((index++, item));
}
return result;
}
}
}