Extension methods for ICollection<T>
More...
|
static bool | AddIfUnique< T > (this ICollection< T > collection, T obj) |
| Adds obj to the collection if it isn't a duplicate of any existing elements. More...
|
|
static int | AddRangeIfUnique< T > (this ICollection< T > collection, IEnumerable< T > range) |
| Calls AddIfUnique<T>(ICollection<T>, T) on the given range of objects. More...
|
|
static bool | ContainsAny< T > (this ICollection< T > collection, params T[] items) |
| Determines whether the collection contains at least one of the specified items . More...
|
|
Extension methods for ICollection<T>
◆ AddIfUnique< T >()
static bool VolumeControl.TypeExtensions.CollectionExtensions.AddIfUnique< T > |
( |
this ICollection< T > |
collection, |
|
|
T |
obj |
|
) |
| |
|
static |
Adds obj to the collection if it isn't a duplicate of any existing elements.
- Template Parameters
-
T | The type of objects contained within the collection . |
- Parameters
-
collection | ICollection |
obj | Object to add to the list. The object is only added if it isn't a duplicate of an existing element, as determined by the default equality comparison operator for type T . |
- Returns
true
when obj was added to collection ; otherwise false
.
◆ AddRangeIfUnique< T >()
static int VolumeControl.TypeExtensions.CollectionExtensions.AddRangeIfUnique< T > |
( |
this ICollection< T > |
collection, |
|
|
IEnumerable< T > |
range |
|
) |
| |
|
static |
Calls AddIfUnique<T>(ICollection<T>, T) on the given range of objects.
- Template Parameters
-
T | The type of objects contained within the collection . |
- Parameters
-
collection | ICollection<T> |
range | A range of objects of type T to add to the list. Each object is only added if it isn't a duplicate of an existing element, as determined by object.Equals(object?). |
- Returns
- The number of items from range that were added to collection .
◆ ContainsAny< T >()
static bool VolumeControl.TypeExtensions.CollectionExtensions.ContainsAny< T > |
( |
this ICollection< T > |
collection, |
|
|
params T[] |
items |
|
) |
| |
|
static |
Determines whether the collection contains at least one of the specified items .
- Template Parameters
-
T | Item type contained within the collection. |
- Parameters
-
collection | The collection to search. |
items | The items to search for in the collection. |
- Returns
true
when at least one of the specified items exists in the collection ; otherwise false
.
The documentation for this class was generated from the following file: