KGy SOFT

ListExtensionsReplaceRangeT Method

KGy SOFT Core Libraries Help
Removes count amount of items from the target IListT at the specified index, and inserts the specified collection at the same position. The number of elements in collection can be different from the amount of removed items.

Namespace:  KGySoft.CoreLibraries
Assembly:  KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 6.0.0
Syntax

public static void ReplaceRange<T>(
	this IList<T> target,
	int index,
	int count,
	IEnumerable<T> collection
)

Parameters

target
Type: System.Collections.GenericIListT
The target collection.
index
Type: SystemInt32
The zero-based index of the first item to remove and also the index at which collection items should be inserted.
count
Type: SystemInt32
The number of items to remove.
collection
Type: System.Collections.GenericIEnumerableT
The collection to insert into the target list.

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

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

See Also

Reference