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

Extensions for the IEnumerable interface type. More...

Collaboration diagram for VolumeControl.TypeExtensions.EnumerableExtensions:

Static Public Member Functions

static IEnumerable< TResult > SelectIfUnique< TSource, TResult > (this IEnumerable< TSource > source, Func< TSource, TResult > selector)
 Similar to the regular Select Linq method except that it only includes selected values that are unique. More...
 
static void ForEach< TSource > (this IEnumerable< TSource > source, Action< TSource > action)
 Performs the specified action on each source element. More...
 
static void ForEach< TSource, TDiscardedResult > (this IEnumerable< TSource > source, Func< TSource, TDiscardedResult > func)
 Performs the specified func on each source element, and discards the result. More...
 
static IEnumerable< TResult > SelectIf< TSource, TResult > (this IEnumerable< TSource > source, Func< TSource, TResult > selector, Func< TSource, bool > predicate)
 Does the same thing as the standard Linq Select() method, except this one uses a predicate and applies the selector only when the predicate returns true. More...
 
static IEnumerable< TSource > SelectValues< TSource > (this IEnumerable< TSource > source)
 Selects non-null values from the enumerable. More...
 
static IEnumerable< TResult > SelectValues< TSource, TResult > (this IEnumerable< TSource > source, Func< TSource, TResult?> selector)
 Selects non-null values from the enumerable using the specified selector . More...
 
static IEnumerable< TResult > Select< TResult > (this IEnumerable source, Func< object, TResult > selector)
 Applies the specified selector to each element and returns the resulting values. More...
 
static void DisposeAll< T > (this IEnumerable< T > source)
 Calls IDisposable.Dispose on all of the elements in the collection. More...
 

Detailed Description

Extensions for the IEnumerable interface type.

Member Function Documentation

◆ DisposeAll< T >()

static void VolumeControl.TypeExtensions.EnumerableExtensions.DisposeAll< T > ( this IEnumerable< T >  source)
static

Calls IDisposable.Dispose on all of the elements in the collection.

Template Parameters
TEnumerable element type that implements IDisposable.
Parameters
source(implicit) The enumerable collection to dispose of.
Type Constraints
T :IDisposable 

◆ ForEach< TSource >()

static void VolumeControl.TypeExtensions.EnumerableExtensions.ForEach< TSource > ( this IEnumerable< TSource >  source,
Action< TSource >  action 
)
static

Performs the specified action on each source element.

◆ ForEach< TSource, TDiscardedResult >()

static void VolumeControl.TypeExtensions.EnumerableExtensions.ForEach< TSource, TDiscardedResult > ( this IEnumerable< TSource >  source,
Func< TSource, TDiscardedResult >  func 
)
static

Performs the specified func on each source element, and discards the result.

Template Parameters
TSourceThe type of object contained by the source .
TDiscardedResultThe type that is returned by the specified func . Returned values are ignored.

◆ Select< TResult >()

static IEnumerable<TResult> VolumeControl.TypeExtensions.EnumerableExtensions.Select< TResult > ( this IEnumerable  source,
Func< object, TResult >  selector 
)
static

Applies the specified selector to each element and returns the resulting values.

Template Parameters
TResultThe type returned by the specified selector .
Parameters
sourceAn untyped enumerable instance to use as the source.
selectorA selector method that accepts an untyped object and returns a TResult instance.
Returns
The enumeration after applying the selector to each element.

◆ SelectIf< TSource, TResult >()

static IEnumerable<TResult> VolumeControl.TypeExtensions.EnumerableExtensions.SelectIf< TSource, TResult > ( this IEnumerable< TSource >  source,
Func< TSource, TResult >  selector,
Func< TSource, bool >  predicate 
)
static

Does the same thing as the standard Linq Select() method, except this one uses a predicate and applies the selector only when the predicate returns true.

Template Parameters
TSource
TResult
Parameters
source
selector
predicateA predicate to apply to each item in source .
Return values are handled as follows:
trueApplies selector to the item, adding it to the returned enumerable.
falseSkips the item, and does not apply the selector .
Returns
Enumerable with values selected in the items of source by the selector , excluding those filtered out by predicate .

◆ SelectIfUnique< TSource, TResult >()

static IEnumerable<TResult> VolumeControl.TypeExtensions.EnumerableExtensions.SelectIfUnique< TSource, TResult > ( this IEnumerable< TSource >  source,
Func< TSource, TResult >  selector 
)
static

Similar to the regular Select Linq method except that it only includes selected values that are unique.

Template Parameters
TSourceInput Type
TResultOutput Type
Parameters
sourceAny enumerable TSource type.
selectorA selector method.
Returns
IEnumerable of type TResult , where each item is unique as determined by the generic Equals() method.

◆ SelectValues< TSource >()

static IEnumerable<TSource> VolumeControl.TypeExtensions.EnumerableExtensions.SelectValues< TSource > ( this IEnumerable< TSource >  source)
static

Selects non-null values from the enumerable.

Template Parameters
TSourceThe type of element in the enumerable.
Returns
The resulting elements that aren't null.

◆ SelectValues< TSource, TResult >()

static IEnumerable<TResult> VolumeControl.TypeExtensions.EnumerableExtensions.SelectValues< TSource, TResult > ( this IEnumerable< TSource >  source,
Func< TSource, TResult?>  selector 
)
static

Selects non-null values from the enumerable using the specified selector .

Template Parameters
TSourceThe type of element in the enumerable.
TResultThe type of element in the resulting enumerable.
Parameters
sourceThe enumerable to apply the selector to.
selectorA function that accepts a parameter of type TSource and returns a TResult instance, or null. When this returns null the item does not appear in the resulting enumeration.
Returns
The resulting elements of type TResult that aren't null.

The documentation for this class was generated from the following file: