Editare

Partajați prin


RuntimeHelpers.CreateSpan<T>(RuntimeFieldHandle) Method

Definition

Provides a fast way to access constant data stored in a module as a ReadOnlySpan<T>.

public:
generic <typename T>
 static ReadOnlySpan<T> CreateSpan(RuntimeFieldHandle fldHandle);
public static ReadOnlySpan<T> CreateSpan<T> (RuntimeFieldHandle fldHandle);
static member CreateSpan : RuntimeFieldHandle -> ReadOnlySpan<'T>
Public Shared Function CreateSpan(Of T) (fldHandle As RuntimeFieldHandle) As ReadOnlySpan(Of T)

Type Parameters

T

The type of the ReadOnlySpan data.

Parameters

fldHandle
RuntimeFieldHandle

A field handle that specifies the location of the data to be referred to by the ReadOnlySpan<T>. The Rva of the field must be aligned on a natural boundary of T.

Returns

The data stored in the field.

Exceptions

fldHandle refers to a field that's not an Rva or is misaligned, or T is of an invalid type.

Remarks

This method is intended for compiler use rather than use directly in code. T must be one of byte, sbyte, char, short, ushort, int, long, ulong, float, or double.

Applies to