Enqueue All - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:Queue

Description

Enqueue All

Demo Code

// Licensed under the Apache License, Version 2.0 (the "License");
using System.Linq;
using System.Collections.Generic;
using System;/* ww  w .j ava 2  s  . c o  m*/

public class Main{


        /// <summary>
        ///     A?ade todos los elementos indicados a una cola.
        /// </summary>
        /// <typeparam name="T">Tipo de la cola.</typeparam>
        /// <param name="collection">Cola.</param>
        /// <param name="enumer">Elementos.</param>
        public static void EnqueueAll<T>(this Queue<T> collection, IEnumerable<T> enumer)
        {
            foreach (T obj in enumer)
            {
                collection.Enqueue(obj);
            }
        }
}

Related Tutorials