語言

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>元素的張成。

例外狀況

list 是 null。

index小於 0 或大於 list。Count

適用於