This commit is contained in:
Zeeshaun
2026-03-17 08:54:34 -05:00
parent 64856c640e
commit cdcba54aa4
330 changed files with 54110 additions and 0 deletions
@@ -0,0 +1,27 @@
namespace ReserveManagementSystemApi.Helpers
{
public static class BatchHelper
{
public static IEnumerable<IEnumerable<TSource>> CreateBatch <TSource>(
List<TSource> source, int batchSize)
{
var items = new TSource[batchSize];
var count = 0;
foreach (var item in source)
{
items[count++] = item;
if (count == batchSize)
{
yield return items;
items = new TSource[batchSize];
count = 0;
}
}
if (count > 0)
{
yield return items.Take(count);
}
}
}
}