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

◆ CopyTo() [1/2]

void ICollection. System.Collections.Generic.Queue< T >.CopyTo ( Array array,
int index )
inlineprivate

Definition at line 188 of file Queue.cs.

189 {
190 if (array == null)
191 {
192 throw new ArgumentNullException("array");
193 }
194 if (array.Rank != 1)
195 {
196 throw new ArgumentException(SR.Arg_RankMultiDimNotSupported, "array");
197 }
198 if (array.GetLowerBound(0) != 0)
199 {
200 throw new ArgumentException(SR.Arg_NonZeroLowerBound, "array");
201 }
202 int length = array.Length;
203 if (index < 0 || index > length)
204 {
205 throw new ArgumentOutOfRangeException("index", index, SR.ArgumentOutOfRange_Index);
206 }
207 if (length - index < _size)
208 {
209 throw new ArgumentException(SR.Argument_InvalidOffLen);
210 }
211 int size = _size;
212 if (size == 0)
213 {
214 return;
215 }
216 try
217 {
218 int num = ((_array.Length - _head < size) ? (_array.Length - _head) : size);
219 Array.Copy(_array, _head, array, index, num);
220 size -= num;
221 if (size > 0)
222 {
223 Array.Copy(_array, 0, array, index + _array.Length - _head, size);
224 }
225 }
226 catch (ArrayTypeMismatchException)
227 {
228 throw new ArgumentException(SR.Argument_InvalidArrayType, "array");
229 }
230 }

References System.Collections.Generic.Queue< T >._array, System.Collections.Generic.Queue< T >._head, System.Collections.Generic.Queue< T >._size, System.SR.Arg_NonZeroLowerBound, System.SR.Arg_RankMultiDimNotSupported, System.SR.Argument_InvalidArrayType, System.SR.Argument_InvalidOffLen, System.SR.ArgumentOutOfRange_Index, System.array, System.Array.Copy(), System.index, and System.length.