This commit is contained in:
Zoe Roux 2020-06-17 23:35:48 +02:00
parent e621327042
commit 866635fe1f

View File

@ -205,7 +205,7 @@ namespace Kyoo
public static IEnumerable<List<T>> BatchBy<T>(this List<T> list, int countPerList) public static IEnumerable<List<T>> BatchBy<T>(this List<T> list, int countPerList)
{ {
for (int i = 0; i < list.Count; i += countPerList) for (int i = 0; i < list.Count; i += countPerList)
yield return list.GetRange(i, Math.Min(list.Count - i, i + countPerList)); yield return list.GetRange(i, Math.Min(list.Count - i, countPerList));
} }
} }
} }