ReadOnlySpanExtensions.AsBytes<T>(ReadOnlySpan<T>) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Casts a ReadOnlySpan<T> of one primitive type T
to ReadOnlySpan<T> of bytes.
public static ReadOnlySpan<byte> AsBytes<T> (this ReadOnlySpan<T> span) where T : struct;
static member AsBytes : ReadOnlySpan<'T (requires 'T : struct)> -> ReadOnlySpan<byte> (requires 'T : struct)
<Extension()>
Public Function AsBytes(Of T As Structure) (span As ReadOnlySpan(Of T)) As ReadOnlySpan(Of Byte)
Type Parameters
- T
The type if items in the source ReadOnlySpan<T>.
Parameters
- span
- ReadOnlySpan<T>
The source slice, of type T
.
Returns
A ReadOnlySpan<T> of bytes.
Exceptions
Thrown if the Length property of the new ReadOnlySpan<T> would exceed MaxValue.