Rediger

Del via


CollectionsMarshal.AsSpan<T>(List<T>) Method

Definition

Gets a Span<T> view over the data in a list. Items should not be added or removed from the List<T> while the Span<T> is in use.

public:
generic <typename T>
 static Span<T> AsSpan(System::Collections::Generic::List<T> ^ list);
public static Span<T> AsSpan<T> (System.Collections.Generic.List<T>? list);
static member AsSpan : System.Collections.Generic.List<'T> -> Span<'T>
Public Shared Function AsSpan(Of T) (list As List(Of T)) As Span(Of T)

Type Parameters

T

The type of items in the list.

Parameters

list
List<T>

List from which to create the Span<T>.

Returns

A Span<T> instance over the List<T>.

Applies to