jackfiled
4b6635796c
Co-authored-by: Huaps <1183155719@qq.com> Co-authored-by: duqoo <92306417+duqoo@users.noreply.github.com> Reviewed-on: PostGuard/Canon#38
16 lines
446 B
C#
16 lines
446 B
C#
namespace Canon.Tests.Utils;
|
|
|
|
public static class EnumerableExtensions
|
|
{
|
|
/// <summary>
|
|
/// 含有索引的遍历
|
|
/// </summary>
|
|
/// <param name="enumerable">可遍历的接口</param>
|
|
/// <typeparam name="T"></typeparam>
|
|
/// <returns></returns>
|
|
public static IEnumerable<(T, uint)> WithIndex<T>(this IEnumerable<T> enumerable)
|
|
{
|
|
return enumerable.Select((value, index) => (value, (uint)index));
|
|
}
|
|
}
|