// using System; // using System.Collections.Generic; // using System.Linq; // using System.Threading.Tasks; // namespace Commerce.Core.Utility; // public static class IEnumerableExtensions // { // public static IEnumerable> Batch(this IEnumerable source, int batchSize) // { // var batch = new List(batchSize); // foreach (var item in source) // { // batch.Add(item); // if (batch.Count == batchSize) // { // yield return batch; // batch = new List(batchSize); // } // } // if (batch.Count > 0) // { // yield return batch; // } // } // }