Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CopyTo()

virtual void System.Collections.Stack.CopyTo ( Array array,
int index )
inlinevirtual

Implements System.Collections.ICollection.

Reimplemented in System.Collections.Stack.SyncStack, and System.Diagnostics.CorrelationManager.AsyncLocalStackWrapper.

Definition at line 296 of file Stack.cs.

297 {
298 if (array == null)
299 {
300 throw new ArgumentNullException("array");
301 }
302 if (array.Rank != 1)
303 {
305 }
306 if (index < 0)
307 {
308 throw new ArgumentOutOfRangeException("index", System.SR.ArgumentOutOfRange_NeedNonNegNum);
309 }
310 if (array.Length - index < _size)
311 {
313 }
314 int i = 0;
315 if (array is object[] array2)
316 {
317 for (; i < _size; i++)
318 {
319 array2[i + index] = _array[_size - i - 1];
320 }
321 }
322 else
323 {
324 for (; i < _size; i++)
325 {
326 array.SetValue(_array[_size - i - 1], i + index);
327 }
328 }
329 }
static string Arg_RankMultiDimNotSupported
Definition SR.cs:18
static string Argument_InvalidOffLen
Definition SR.cs:22
static string ArgumentOutOfRange_NeedNonNegNum
Definition SR.cs:32
Definition SR.cs:7

References System.Collections.Stack._array, System.Collections.Stack._size, System.SR.Arg_RankMultiDimNotSupported, System.SR.Argument_InvalidOffLen, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.array, and System.index.

Referenced by System.Collections.Stack.SyncStack.CopyTo().