AsBytes()

MemoryMarshal::AsBytes(const Span<T>&) method

Casts a Span of one primitive type T to Span of bytes.

template<typename T> static Span<uint8_t> System::Runtime::InteropServices::MemoryMarshal::AsBytes(const Span<T> &span)

Template parameters

ParameterDescription
TThe type of elements in the span.

Arguments

ParameterTypeDescription
spanconst Span<T>&The span to cast.

Return Value

A span of bytes representing the same memory as the original span.

See Also