Enqueues the elements of the specified collection to the . The type of elements in the collection. The to add items to. The collection whose elements should be added to the . It can contain elements that are <see langword="nu
(this Queue<T> queue, IEnumerable<T> collection)
| 108 | /// <param name="collection">The collection whose elements should be added to the <paramref name="queue"/>. It can contain elements that are <see langword="null"/>, if type <typeparamref name="T"/> is a reference type.</param> |
| 109 | /// <exception cref="ArgumentNullException">If <paramref name="queue"/> or <paramref name="collection"/> are <see langword="null"/>.</exception> |
| 110 | public static void EnqueueRange<T>(this Queue<T> queue, IEnumerable<T> collection) |
| 111 | { |
| 112 | if (queue == null) |
| 113 | throw new ArgumentNullException(nameof(queue)); |
| 114 | if (collection == null) |
| 115 | throw new ArgumentNullException(nameof(collection)); |
| 116 | foreach (var item in collection) |
| 117 | { |
| 118 | queue.Enqueue(item); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | /// <summary> |
| 123 | /// Pushes the elements of the specified collection to the <see cref="Stack{T}"/>. |