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

◆ CopyTo() [1/4]

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

Definition at line 599 of file Dictionary.cs.

600 {
601 if (array == null)
602 {
603 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
604 }
605 if (array.Rank != 1)
606 {
607 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
608 }
609 if (array.GetLowerBound(0) != 0)
610 {
611 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
612 }
613 if ((uint)index > (uint)array.Length)
614 {
615 ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
616 }
617 if (array.Length - index < _dictionary.Count)
618 {
619 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
620 }
621 if (array is TValue[] array2)
622 {
624 return;
625 }
626 object[] array3 = array as object[];
627 if (array3 == null)
628 {
629 ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
630 }
631 int count = _dictionary._count;
632 Entry[] entries = _dictionary._entries;
633 try
634 {
635 for (int i = 0; i < count; i++)
636 {
637 if (entries[i].next >= -1)
638 {
639 array3[index++] = entries[i].value;
640 }
641 }
642 }
643 catch (ArrayTypeMismatchException)
644 {
645 ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
646 }
647 }
readonly Dictionary< TKey, TValue > _dictionary

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