Edit

Share via


ReadOnlySpanExtensions.DangerousGetReference<T> Method

Definition

Returns a reference to the first element within a given ReadOnlySpan<T>, with no bounds checks.

public static ref T DangerousGetReference<T> (this ReadOnlySpan<T> span);
static member DangerousGetReference : ReadOnlySpan<'T> -> 'T
<Extension()>
Public Function DangerousGetReference(Of T) (span As ReadOnlySpan(Of T)) As T

Type Parameters

T

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

Parameters

span
ReadOnlySpan<T>

The input ReadOnlySpan<T> instance.

Returns

T

A reference to the first element within span.

Remarks

This method doesn't do any bounds checks, therefore it is responsibility of the caller to perform checks in case the returned value is dereferenced.

Applies to