CollectionExtensions.InsertRange<T> Method

Definition

Inserts the elements of a span into the List<T> at the specified index.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static void InsertRange(System::Collections::Generic::List<T> ^ list, int index, ReadOnlySpan<T> source);
public static void InsertRange<T> (this System.Collections.Generic.List<T> list, int index, ReadOnlySpan<T> source);
static member InsertRange : System.Collections.Generic.List<'T> * int * ReadOnlySpan<'T> -> unit
<Extension()>
Public Sub InsertRange(Of T) (list As List(Of T), index As Integer, source As ReadOnlySpan(Of T))

Type Parameters

T

The type of elements in the list.

Parameters

list
List<T>

The list into which the elements should be inserted.

index
Int32

The zero-based index at which the new elements should be inserted.

source
ReadOnlySpan<T>

The span whose elements should be added to the List<T>.

Exceptions

The list is null.

index is less than 0 or greater than list's Count.

Applies to