Elements Class
The utility class for ICollection<T> objects and loop operations.
public static class Elements
- Inheritance
-
Elements
Methods
For |
Performs an action for each |
If |
Accepts the specified consumer function if the specified collection is not empty. |
Difference |
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.
public static void ForEach(int count, Action<int> consumer)
Parameters
- count
- int
The exclusive upper bound.
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.
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.
public static ISet<T> DifferenceOf<T>(IEnumerable<T> a, IEnumerable<T> b)
Type Parameters
- T
The type of the element.
Parameters
The collection A.
The collection B.