using System.Collections.Generic; using System.Linq; namespace InABox.Core { public static class QueueExtensions { public static IEnumerable Dequeue(this Queue queue, int chunkSize) { for (int i = 0; i < chunkSize && queue.Count > 0; i++) { yield return queue.Dequeue(); } } public static Queue ToQueue(this IEnumerable enumerable) { return new Queue(enumerable.ToArray()); } } }