Marshal. Create Read Only Span<T>(T, Int32) Method
Creates a new read-only span over a portion of a regular managed object.
public: generic <typename T> static ReadOnlySpan<T> CreateReadOnlySpan(T % reference, int length);
public static ReadOnlySpan<T> CreateReadOnlySpan<T> (ref T reference, int length);
static member CreateReadOnlySpan : 'T * int -> ReadOnlySpan<'T>
Public Shared Function CreateReadOnlySpan(Of T) (ByRef reference As T, length As Integer) As ReadOnlySpan(Of T)
The type of the data items.
A reference to data.
The number of
T elements that
A read-only span.
This method can be useful if part of a managed object represents a fixed array.
This method should be used with caution. It is dangerous because the
length argument is not checked. In addition, the lifetime of the returned span is not validated for safety by span-aware languages.