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

◆ AsSpan< T >() [8/10]

static Span< T > System.MemoryExtensions.AsSpan< T > ( this T?[] array,
int start )
inlinestatic

Definition at line 301 of file MemoryExtensions.cs.

302 {
303 if (array == null)
304 {
305 if (start != 0)
306 {
307 ThrowHelper.ThrowArgumentOutOfRangeException();
308 }
309 return default(Span<T>);
310 }
311 if (!typeof(T).IsValueType && array.GetType() != typeof(T[]))
312 {
313 ThrowHelper.ThrowArrayTypeMismatchException();
314 }
315 if ((uint)start > (uint)array.Length)
316 {
317 ThrowHelper.ThrowArgumentOutOfRangeException();
318 }
319 return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start), array.Length - start);
320 }
static unsafe ref byte GetArrayDataReference(Array array)

References System.array, System.Runtime.InteropServices.MemoryMarshal.GetArrayDataReference(), System.start, System.ThrowHelper.ThrowArgumentOutOfRangeException(), and System.ThrowHelper.ThrowArrayTypeMismatchException().