ListExtensions Class
Provides extension methods for the IList<T> type.
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<T>.
public static void AddRange<T>(this IList<T> list, IEnumerable<T> collection)
- Type Parameters:
-
T
-
Parameter | Type | Description |
---|---|---|
list | IList<T> | |
collection | IEnumerable<T> | The collection whose elements should be added to the end of the List<T>. The collection itself cannot be |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
InsertRange<T>(IList<T>, int, IEnumerable<T>)
Inserts the elements of a collection into the List<T> at the specified index.
public static void InsertRange<T>(this IList<T> list, int index, IEnumerable<T> collection)
- Type Parameters:
-
T
-
Parameter | Type | Description |
---|---|---|
list | IList<T> | |
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<T>. The collection itself cannot be |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
-or-
|
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
-
Parameter | Type | Description |
---|---|---|
list | IList<T> | |
match | Predicate<T> | The Predicate<T> delegate that defines the conditions of the elements to remove. |
Returns
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|