Esempio n. 1
0
 /// <summary>Copies the contents of the queue to an array.</summary>
 /// <param name="array">The array to copy to.</param>
 /// <param name="arrayIndex">The index within the array at which to start copying.</param>
 /// <exception cref="ArgumentNullException">The array was null.</exception>
 /// <exception cref="ArgumentOutOfRangeException">The array index was less than zero.</exception>
 /// <exception cref="ArgumentException">The number of items in the collection was
 /// too great to copy into the array at the index given.</exception>
 /// <remarks>This method races with other threads as described for
 /// <see cref="SlimConcurrentQueue{T}.Snapshot()"/>.</remarks>
 public void CopyTo(T[] array, int arrayIndex)
 {
     Validation.CopyTo(array, arrayIndex);
     new List <T>(_backing.Snapshot()).CopyTo(array, arrayIndex);
 }
Esempio n. 2
0
 void IProducerConsumerCollection <IEnumerable <T> > .CopyTo(IEnumerable <T>[] array, int index)
 {
     Validation.CopyTo(array, index);
     array[index] = _backing.Snapshot();
 }