Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ CopyTo() [2/2]

void System.Collections.Concurrent.ConcurrentQueue< T >.CopyTo ( T[] array,
int index )
inlineinherited

Implements System.Collections.Concurrent.IProducerConsumerCollection< T >.

Definition at line 203 of file ConcurrentQueue.cs.

204 {
205 if (array == null)
206 {
207 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
208 }
209 if (index < 0)
210 {
211 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index);
212 }
214 long count = GetCount(head, headHead, tail, tailTail);
215 if (index > array.Length - count)
216 {
217 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
218 }
219 int num = index;
220 using IEnumerator<T> enumerator = Enumerate(head, headHead, tail, tailTail);
221 while (enumerator.MoveNext())
222 {
223 array[num++] = enumerator.Current;
224 }
225 }
void SnapForObservation(out ConcurrentQueueSegment< T > head, out int headHead, out ConcurrentQueueSegment< T > tail, out int tailTail)
static int GetCount(ConcurrentQueueSegment< T > s, int head, int tail)
static IEnumerator< T > Enumerate(ConcurrentQueueSegment< T > head, int headHead, ConcurrentQueueSegment< T > tail, int tailTail)

References System.array, System.count, System.Collections.Concurrent.ConcurrentQueue< T >.Enumerate(), System.Collections.Concurrent.ConcurrentQueue< T >.GetCount(), System.index, System.Collections.Concurrent.ConcurrentQueue< T >.SnapForObservation(), System.ThrowHelper.ThrowArgumentException(), System.ThrowHelper.ThrowArgumentNullException(), and System.ThrowHelper.ThrowArgumentOutOfRangeException().