Modifica

Condividi tramite


ReadOnlySpanExtensions.DangerousGetReferenceAt Method

Definition

Overloads

DangerousGetReferenceAt<T>(ReadOnlySpan<T>, Int32)

Returns a reference to an element at a specified index within a given ReadOnlySpan<T>, with no bounds checks.

DangerousGetReferenceAt<T>(ReadOnlySpan<T>, IntPtr)

Returns a reference to an element at a specified index within a given ReadOnlySpan<T>, with no bounds checks.

DangerousGetReferenceAt<T>(ReadOnlySpan<T>, Int32)

Returns a reference to an element at a specified index within a given ReadOnlySpan<T>, with no bounds checks.

public static ref T DangerousGetReferenceAt<T> (this ReadOnlySpan<T> span, int i);
static member DangerousGetReferenceAt : ReadOnlySpan<'T> * int -> 'T
<Extension()>
Public Function DangerousGetReferenceAt(Of T) (span As ReadOnlySpan(Of T), i As Integer) As T

Type Parameters

T

The type of elements in the input ReadOnlySpan<T> instance.

Parameters

span
ReadOnlySpan<T>

The input ReadOnlySpan<T> instance.

i
Int32

The index of the element to retrieve within span.

Returns

T

A reference to the element within span at the index specified by i.

Remarks

This method doesn't do any bounds checks, therefore it is responsibility of the caller to ensure the i parameter is valid.

Applies to

DangerousGetReferenceAt<T>(ReadOnlySpan<T>, IntPtr)

Returns a reference to an element at a specified index within a given ReadOnlySpan<T>, with no bounds checks.

public static ref T DangerousGetReferenceAt<T> (this ReadOnlySpan<T> span, nint i);
static member DangerousGetReferenceAt : ReadOnlySpan<'T> * nativeint -> 'T
<Extension()>
Public Function DangerousGetReferenceAt(Of T) (span As ReadOnlySpan(Of T), i As IntPtr) As T

Type Parameters

T

The type of elements in the input ReadOnlySpan<T> instance.

Parameters

span
ReadOnlySpan<T>

The input ReadOnlySpan<T> instance.

i
IntPtr

nint

nativeint

The index of the element to retrieve within span.

Returns

T

A reference to the element within span at the index specified by i.

Remarks

This method doesn't do any bounds checks, therefore it is responsibility of the caller to ensure the i parameter is valid.

Applies to