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

◆ ArrayWithOffset()

System.Runtime.InteropServices.ArrayWithOffset.ArrayWithOffset ( object? array,
int offset )
inline

Definition at line 14 of file ArrayWithOffset.cs.

15 {
16 int num = 0;
17 if (array != null)
18 {
19 if (!(array is Array { Rank: 1 } array2) || !Marshal.IsPinnable(array2))
20 {
21 throw new ArgumentException(SR.ArgumentException_NotIsomorphic);
22 }
23 nuint num2 = array2.NativeLength * array2.GetElementSize();
24 if (num2 > 2147483632)
25 {
26 throw new ArgumentException(SR.Argument_StructArrayTooLarge);
27 }
28 num = (int)num2;
29 }
30 if ((uint)offset > (uint)num)
31 {
32 throw new IndexOutOfRangeException(SR.IndexOutOfRange_ArrayWithOffset);
33 }
34 m_array = array;
36 m_count = num - offset;
37 }

References System.SR.Argument_StructArrayTooLarge, System.SR.ArgumentException_NotIsomorphic, System.array, System.SR.IndexOutOfRange_ArrayWithOffset, System.Runtime.InteropServices.Marshal.IsPinnable(), System.Runtime.InteropServices.ArrayWithOffset.m_array, System.Runtime.InteropServices.ArrayWithOffset.m_count, System.Runtime.InteropServices.ArrayWithOffset.m_offset, and System.offset.