ListExtensionsRemoveRangeT Method

Removes count amount of items from the specified collection at the specified index.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
C#
public static void RemoveRange<T>(
	this IList<T> collection,
	int index,
	int count
)

Parameters

collection  IListT
The list to remove the elements from.
index  Int32
The zero-based index of the first item to remove.
count  Int32
The number of items to remove.

Type Parameters

T
The type of the elements in the collection.

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 collection is neither a ListT nor an ISupportsRangeListT implementation, then the elements will be removed one by one.

Exceptions

ArgumentOutOfRangeExceptionindex is not a valid index in the CircularListT.
-or-
count is less than 0.
ArgumentExceptionindex and count do not denote a valid range of elements in the list.

See Also