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

◆ TryRead< T >()

static bool System.Runtime.InteropServices.MemoryMarshal.TryRead< T > ( ReadOnlySpan< byte > source,
out T value )
inlinestatic
Type Constraints
T :struct 

Definition at line 258 of file MemoryMarshal.cs.

258 : struct
259 {
260 if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
261 {
262 ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
263 }
264 if (Unsafe.SizeOf<T>() > (uint)source.Length)
265 {
266 value = default(T);
267 return false;
268 }
269 value = Unsafe.ReadUnaligned<T>(ref GetReference(source));
270 return true;
271 }

References System.source, System.ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(), and System.value.