EnqueueAll
Enqueues an aray of items to a Queue rather than having to loop and call Enqueue for each item.
Source
public static class QueueExtensions
{
public static void EnqueueAll<T>(this Queue<T> queue, T[] items)
{
foreach (var item in items)
queue.Enqueue(item);
}
}
Example
queue.EnqueueAll(new string[]
{
"foo", "bar"
});
Author: Mike Cromwell
Submitted on: 18 okt. 2010
Language: C#
Type: System.Collections.Generic.Queue
Views: 4010