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

◆ Span() [2/4]

System.Span< T >.Span ( T?[] array,
int start,
int length )
inline

Definition at line 106 of file Span.cs.

107 {
108 if (array == null)
109 {
110 if (start != 0 || length != 0)
111 {
112 ThrowHelper.ThrowArgumentOutOfRangeException();
113 }
114 this = default(Span<T>);
115 return;
116 }
117 if (!typeof(T).IsValueType && array.GetType() != typeof(T[]))
118 {
119 ThrowHelper.ThrowArrayTypeMismatchException();
120 }
121 if ((ulong)((long)(uint)start + (long)(uint)length) > (ulong)(uint)array.Length)
122 {
123 ThrowHelper.ThrowArgumentOutOfRangeException();
124 }
125 _pointer = new ByReference<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start));
126 _length = length;
127 }
static unsafe ref byte GetArrayDataReference(Array array)
readonly ByReference< T > _pointer
Definition Span.cs:50
readonly int _length
Definition Span.cs:52

References System.Span< T >._length, System.Span< T >._pointer, System.array, System.Runtime.InteropServices.MemoryMarshal.GetArrayDataReference(), System.length, System.start, System.ThrowHelper.ThrowArgumentOutOfRangeException(), and System.ThrowHelper.ThrowArrayTypeMismatchException().