ListExtensions Class
public static class ListExtensions
- Inheritance:
- object object
Methods
AddRange<T>(IList<T>, IEnumerable<T>)
Adds the elements of the specified collection to the end of the list.
public static void AddRange<T>(this IList<T> list, IEnumerable<T> collection)
- Type Parameters:
-
T
-The type of elements in the list.
Parameter | Type | Description |
---|---|---|
list | IList<T> | The list to which the items should be added. |
collection | IEnumerable<T> | The collection whose elements should be added to the end of the list. The collection itself cannot be null, but it can contain elements that are null, if type |
InsertRange<T>(IList<T>, int, IEnumerable<T>)
Inserts the elements of a collection into the list at the specified index.
public static void InsertRange<T>(this IList<T> list, int index, IEnumerable<T> collection)
- Type Parameters:
-
T
-The type of elements in the list.
Parameter | Type | Description |
---|---|---|
list | IList<T> | The list to which the items should be inserted. |
index | int | The zero-based index at which the new elements should be inserted.. |
collection | IEnumerable<T> | The collection whose elements should be inserted into the list. The collection itself cannot be null, but it can contain elements that are null, if type |
RemoveAll<T>(IList<T>, Predicate<T>)
Removes all the elements that match the conditions defined by the specified predicate.
public static int RemoveAll<T>(this IList<T> list, Predicate<T> match)
- Type Parameters:
-
T
-The type of elements in the list.
Parameter | Type | Description |
---|---|---|
list | IList<T> | The list from with the items should be removed. |
match | Predicate<T> | The Predicate<T> delegate that defines the conditions of the elements to remove. |