ExtensionMethod.NET Home of 876 C#, Visual Basic, F# and Javascript extension methods


Enqueues all objects from an IEnumerable<T> to the specified queue.


/// <summary>
/// Extensions to the <see cref="Queue{T}"/> class.
/// </summary>
public static class QueueExtensions
    /// <summary>
    /// Enqueues all the specified objects.
    /// </summary>
    /// <typeparam name="T">The type of objects in the queue.</typeparam>
    /// <param name="queue">The queue.</param>
    /// <param name="items">The items to enqueue.</param>
    public static void EnqueueAll<T>(this Queue<T> queue, IEnumerable<T> items)
        foreach (var item in items)


Queue<string> queue = new Queue<string>();
queue.EnqueueAll(new string[]{"A", "B", "C"});

Author: Virtlink

Submitted on: 2 feb 2012

Language: C#

Type: System.Collections.Generic.Queue<T>

Views: 4885