Class CollectionExtensions
Inheritance
CollectionExtensions
Assembly: NanoByte.Common.dll
Syntax
public static class CollectionExtensions : Object
Methods
Add<TCollection, TElements>(ICollection<TCollection>, IEnumerable<TElements>)
Adds multiple elements to the collection.
Declaration
public static void Add<TCollection, TElements>(this ICollection<TCollection> collection, IEnumerable<TElements> elements)
where TElements : TCollection
Parameters
Type Parameters
Name |
Description |
TCollection |
|
TElements |
|
AddIfNew<T>(ICollection<T>, T)
Adds an element to the collection if it does not already Contains(T) the element.
Declaration
public static bool AddIfNew<T>(this ICollection<T> collection, T element)
Parameters
Type |
Name |
Description |
ICollection<T> |
collection |
|
T |
element |
|
Returns
Type |
Description |
Boolean |
true if the element was added to the collection; true if the collection already contained the element.
|
Type Parameters
Remove<TCollection, TElements>(ICollection<TCollection>, IEnumerable<TElements>)
Removes multiple elements from the collection.
Declaration
public static bool Remove<TCollection, TElements>(this ICollection<TCollection> collection, IEnumerable<TElements> elements)
where TElements : TCollection
Parameters
Returns
Type |
Description |
Boolean |
true if any elements where removed.
|
Type Parameters
Name |
Description |
TCollection |
|
TElements |
|
RemoveAll<T>(ICollection<T>, Func<T, Boolean>)
Removes all items from a collection
that match a specific condition
.
Declaration
public static bool RemoveAll<T>(this ICollection<T> collection, Func<T, bool> condition)
Parameters
Returns
Type |
Description |
Boolean |
true if any elements where removed.
|
Type Parameters
See Also