ListExtensionsInsertRangeT Method

Inserts a collection into the target IListT.


Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.2.0
public static void InsertRange<T>(
	this IList<T> target,
	int index,
	IEnumerable<T> collection


target  IListT
The target collection.
index  Int32
The zero-based index at which collection items should be inserted.
collection  IEnumerableT
The collection to insert into the target.

Type Parameters

The type of the elements in the collections.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IListT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).



If target is neither a ListT nor an ISupportsRangeListT implementation, then the elements of collection will be inserted one by one.


ArgumentNullExceptiontarget or collection is .
ArgumentOutOfRangeExceptionindex is not a valid index in the CircularListT.

See Also