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

◆ CopyTo() [1/4]

void ICollection. System.Collections.Generic.Dictionary< TKey, TValue >.KeyCollection.CopyTo ( Array array,
int index )
inlineprivate

Definition at line 397 of file Dictionary.cs.

398 {
399 if (array == null)
400 {
401 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
402 }
403 if (array.Rank != 1)
404 {
405 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
406 }
407 if (array.GetLowerBound(0) != 0)
408 {
409 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
410 }
411 if ((uint)index > (uint)array.Length)
412 {
413 ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
414 }
415 if (array.Length - index < _dictionary.Count)
416 {
417 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
418 }
419 if (array is TKey[] array2)
420 {
422 return;
423 }
424 object[] array3 = array as object[];
425 if (array3 == null)
426 {
427 ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
428 }
429 int count = _dictionary._count;
430 Entry[] entries = _dictionary._entries;
431 try
432 {
433 for (int i = 0; i < count; i++)
434 {
435 if (entries[i].next >= -1)
436 {
437 array3[index++] = entries[i].key;
438 }
439 }
440 }
441 catch (ArrayTypeMismatchException)
442 {
443 ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
444 }
445 }
readonly Dictionary< TKey, TValue > _dictionary

References System.Collections.Generic.Dictionary< TKey, TValue >.KeyCollection._dictionary, System.array, System.Collections.Generic.Dictionary< TKey, TValue >.KeyCollection.CopyTo(), System.count, System.index, System.ThrowHelper.ThrowArgumentException(), System.ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(), System.ThrowHelper.ThrowArgumentNullException(), and System.ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException().