Volume Control
Application-specific hotkeys for Windows
VolumeControl.TypeExtensions.CollectionExtensions Class Reference

Extension methods for ICollection<T> More...

Collaboration diagram for VolumeControl.TypeExtensions.CollectionExtensions:

Static Public Member Functions

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...
 

Detailed Description

Extension methods for ICollection<T>

Member Function Documentation

◆ AddIfUnique< T >()

static bool VolumeControl.TypeExtensions.CollectionExtensions.AddIfUnique< T > ( this ICollection< T >  collection,
obj 
)
static

Adds obj to the collection if it isn't a duplicate of any existing elements.

Template Parameters
TThe type of objects contained within the collection .
Parameters
collectionICollection
objObject 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
TThe type of objects contained within the collection .
Parameters
collectionICollection<T>
rangeA 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
TItem type contained within the collection.
Parameters
collectionThe collection to search.
itemsThe 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: