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

◆ CopyTo() [2/2]

void System.Collections.Generic.Queue< T >.CopyTo ( T[] array,
int arrayIndex )
inline

Implements System.Collections.Generic.ICollection< T >.

Definition at line 161 of file Queue.cs.

162 {
163 if (array == null)
164 {
165 throw new ArgumentNullException("array");
166 }
167 if (arrayIndex < 0 || arrayIndex > array.Length)
168 {
169 throw new ArgumentOutOfRangeException("arrayIndex", arrayIndex, SR.ArgumentOutOfRange_Index);
170 }
171 if (array.Length - arrayIndex < _size)
172 {
173 throw new ArgumentException(SR.Argument_InvalidOffLen);
174 }
175 int size = _size;
176 if (size != 0)
177 {
178 int num = Math.Min(_array.Length - _head, size);
179 Array.Copy(_array, _head, array, arrayIndex, num);
180 size -= num;
181 if (size > 0)
182 {
183 Array.Copy(_array, 0, array, arrayIndex + _array.Length - _head, size);
184 }
185 }
186 }

References System.Collections.Generic.Queue< T >._array, System.Collections.Generic.Queue< T >._head, System.Collections.Generic.Queue< T >._size, System.SR.Argument_InvalidOffLen, System.SR.ArgumentOutOfRange_Index, System.array, System.arrayIndex, System.Array.Copy(), and System.Math.Min().