Method TryRead
TryRead<T>(ReadOnlyExSpan<byte>, out T)
Tries to read a structure of type T
from a read-only span of bytes (尝试从字节的只读跨度中读取 T
类型结构体).
public static bool TryRead<T>(ReadOnlyExSpan<byte> source, out T value) where T : struct
Parameters
source
ReadOnlyExSpan<byte>The source span (源跨度).
value
TWhen the method returns, an instance of
T
(此方法返回时,为T
的实例).
Returns
- bool
true if the method succeeds in retrieving an instance of the structure; otherwise, false (如果此方法成功检索到结构体的实例, 则为 true; 否则为 false).
Type Parameters
T
The element type (元素的类型).
Exceptions
- ArgumentException
T contains managed object references.