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

◆ Copy() [4/5]

static unsafe void System.Array.Copy ( Array sourceArray,
int sourceIndex,
Array destinationArray,
int destinationIndex,
int length,
bool reliable )
inlinestaticprivate

Definition at line 680 of file Array.cs.

681 {
682 if (sourceArray == null)
683 {
684 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.sourceArray);
685 }
686 if (destinationArray == null)
687 {
688 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.destinationArray);
689 }
690 if (sourceArray.GetType() != destinationArray.GetType() && sourceArray.Rank != destinationArray.Rank)
691 {
692 throw new RankException(SR.Rank_MustMatch);
693 }
694 if (length < 0)
695 {
696 throw new ArgumentOutOfRangeException("length", SR.ArgumentOutOfRange_NeedNonNegNum);
697 }
698 int lowerBound = sourceArray.GetLowerBound(0);
700 {
701 throw new ArgumentOutOfRangeException("sourceIndex", SR.ArgumentOutOfRange_ArrayLB);
702 }
704 int lowerBound2 = destinationArray.GetLowerBound(0);
706 {
707 throw new ArgumentOutOfRangeException("destinationIndex", SR.ArgumentOutOfRange_ArrayLB);
708 }
710 if ((uint)(sourceIndex + length) > sourceArray.NativeLength)
711 {
712 throw new ArgumentException(SR.Arg_LongerThanSrcArray, "sourceArray");
713 }
714 if ((uint)(destinationIndex + length) > destinationArray.NativeLength)
715 {
716 throw new ArgumentException(SR.Arg_LongerThanDestArray, "destinationArray");
717 }
719 {
721 nuint num = methodTable->ComponentSize;
722 nuint num2 = (uint)length * num;
725 if (methodTable->ContainsGCPointers)
726 {
727 Buffer.BulkMoveWithWriteBarrier(ref reference2, ref reference, num2);
728 }
729 else
730 {
732 }
733 }
734 else
735 {
736 if (reliable)
737 {
738 throw new ArrayTypeMismatchException(SR.ArrayTypeMismatch_ConstrainedCopy);
739 }
741 }
742 }
static void CopySlow(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length)
static bool IsSimpleCopy(Array sourceArray, Array destinationArray)
static unsafe MethodTable * GetMethodTable(object obj)
static unsafe ref byte GetArrayDataReference(Array array)

References System.SR.Arg_LongerThanDestArray, System.SR.Arg_LongerThanSrcArray, System.SR.ArgumentOutOfRange_ArrayLB, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.SR.ArrayTypeMismatch_ConstrainedCopy, System.Buffer.BulkMoveWithWriteBarrier(), System.Array.CopySlow(), System.destinationArray, System.destinationIndex, System.Runtime.InteropServices.MemoryMarshal.GetArrayDataReference(), System.Runtime.CompilerServices.RuntimeHelpers.GetMethodTable(), System.Array.IsSimpleCopy(), System.length, System.Buffer.Memmove(), System.SR.Rank_MustMatch, System.sourceArray, System.sourceIndex, and System.ThrowHelper.ThrowArgumentNullException().