Skip to content

Instantly share code, notes, and snippets.

@DTTerastar
Created January 22, 2013 17:23
Show Gist options
  • Save DTTerastar/4596445 to your computer and use it in GitHub Desktop.
Save DTTerastar/4596445 to your computer and use it in GitHub Desktop.
public static IEnumerable<T> Unpage<T>(Func<int, int, IEnumerable<T>> func, int batchSize)
{
int skip = 0;
int count;
do
{
count = 0;
foreach (var a in func(skip, batchSize))
{
count++;
yield return a;
}
skip += batchSize;
} while (count == batchSize);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment