CollectionExtensions.InsertRange<T> 方法

定义

将跨度 List<T> 元素插入到指定索引处。

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, scoped 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))

类型参数

T

列表中的元素类型。

参数

list
List<T>

应在其中插入元素的列表。

index
Int32

应插入新元素的从零开始的索引。

source
ReadOnlySpan<T>

其元素应添加到的 List<T>跨度。

例外

listnull

index 小于 0 或大于 list's Count

适用于