ListExtensionsInsertRangeT Method

Inserts a collection into the target IListT.

Definition

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

Parameters

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

T
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).

Remarks

  Note

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

Exceptions

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

See Also