Elements Class

The utility class for ICollection<T> objects and loop operations.

C#
public static class Elements
Inheritance
Elements

Methods

ForEach(int, Action<int>)

Performs an action for each int value that is sequential ordered from 0 (inclusive) to the specified value (exclusive) by an incremental step of 1.

IfNotEmpty<T>(IEnumerable<T>, Action<IEnumerable<T>>)

Accepts the specified consumer function if the specified collection is not empty.

DifferenceOf<T>(IEnumerable<T>, IEnumerable<T>)

Returns the relative complement of B in A (also called the set-theoretic difference of A and B), denoted by A \ B (or A − B), is the set of all elements that are members of A but not members of B.

Methods Detail

ForEach(int, Action<int>)

Performs an action for each int value that is sequential ordered from 0 (inclusive) to the specified value (exclusive) by an incremental step of 1.

C#
public static void ForEach(int count, Action<int> consumer)

Parameters

count
int

The exclusive upper bound.

consumer
Action<int>

The action to perform count times with the argument 0, 1, ..., count − 1 (in order of increasing).

IfNotEmpty<T>(IEnumerable<T>, Action<IEnumerable<T>>)

Accepts the specified consumer function if the specified collection is not empty.

C#
public static void IfNotEmpty<T>(IEnumerable<T> all, Action<IEnumerable<T>> consumer)

Type Parameters

T

The type of the collection's element.

Parameters

all
IEnumerable<T>

The collection.

consumer
Action<IEnumerable<T>>

The consumer function to apply when the collection is not empty.

DifferenceOf<T>(IEnumerable<T>, IEnumerable<T>)

Returns the relative complement of B in A (also called the set-theoretic difference of A and B), denoted by A \ B (or A − B), is the set of all elements that are members of A but not members of B.

C#
public static ISet<T> DifferenceOf<T>(IEnumerable<T> a, IEnumerable<T> b)

Type Parameters

T

The type of the element.

Parameters

a
IEnumerable<T>

The collection A.

b
IEnumerable<T>

The collection B.

Returns

The new ISet<T> object that has the relative complement of B in A.