IEnumerable<T> Interface

Definition

Represents a read-only sequence of elements. Exposes the enumerator, which supports a simple iteration over a collection of a specified type.

Delphi
type IEnumerable<T> = interface(IInterface)

Type Parameters

T

The type of elements to enumerate.

Inheritance
IInterface
IEnumerable<T>
Derived
TDroppedFilesEnumerable
TFileEnumerable
TFileListEnumerable

Properties

Comparer

Gets the assigned comparer. If no comparer was assigned it returns the default comparer.

Count

Returns the number of elements in the sequence.

ElementType

Gets the type of the elements in the sequence.

IsEmpty

Determines whether the sequence contains no elements.

Methods

Aggregate(Func<T,T,T>)

Applies an accumulator function over the sequence.

All(Predicate<T>)

Determines whether all elements of the sequence satisfy a condition.

Any

Determines whether the sequence contains any elements.

Any(Predicate<T>)

Determines whether any element of the sequence satisfies a condition.

AsObject

Returns the reference to this instance.

AtLeast(Integer)

Determines whether or not the number of elements in the sequence is greater than or equal to the given count.

AtMost(Integer)

Determines whether or not the number of elements in the sequence is lesser than or equal to the given count.

Average

Computes the average of the sequence.

Average(Func<T,Currency>)

Computes the average of a sequence of Currency values that are obtained by invoking a transform function on each element of the input sequence.

Average(Func<T,Double>)

Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.

Average(Func<T,Int64>)

Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.

Average(Func<T,Integer>)

Computes the average of a sequence of Integer values that are obtained by invoking a transform function on each element of the input sequence.

Average(Func<T,Single>)

Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.

Between(Integer, Integer)

Determines whether or not the number of elements in the sequence is between an inclusive range of minimum and maximum integers.

Concat(IEnumerable<T>)

Concatenates two sequences.

Contains(T)

Determines whether the sequence contains a specified element by using the default equality comparer.

Contains(T, IEqualityComparer<T>)

Determines whether the sequence contains a specified element by using a specified equality comparer.

Contains(T, TEqualityComparison<T>)

Determines whether the sequence contains a specified element by using a specified equality comparison.

DefaultIfEmpty

Returns the elements of the sequence or the default value in a sequence if the sequence is empty.

DefaultIfEmpty(T)

Returns the elements of the sequence or the specified default value in sequence if the sequence is empty.

Distinct

Returns distinct elements from a sequence by using the default equality comparer to compare values.

Distinct(IEqualityComparer<T>)

Returns distinct elements from the sequence by using a specified equality comparer to compare values.

ElementAt(Integer)

Returns the element at a specified index in the sequence.

ElementAtOrDefault(Integer)

Returns the element at a specified index in the sequence or a default value if the index is out of range.

ElementAtOrDefault(Integer, T)

Returns the element at a specified index in the sequence or the specified default value if the index is out of range.

EqualsTo(IEnumerable<T>)

Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.

EqualsTo(IEnumerable<T>, IEqualityComparer<T>)

Determines whether two sequences are equal by comparing their elements by using a specified equality comparer.

EqualsTo(array of T)

Determines whether the sequences is equal to the specified array by comparing the elements by using the default equality comparer for their type.

Exactly(Integer)

Determines whether or not the number of elements in the sequence is equals to the given count.

Exclude(IEnumerable<T>)

Produces the set difference of two sequences by using the default equality comparer to compare values.

Exclude(IEnumerable<T>, IEqualityComparer<T>)

Produces the set difference of two sequences by using the specified equality comparer to compare values.

First

Returns the first element of the sequence.

First(Predicate<T>)

Returns the first element in the sequence that satisfies a specified condition.

FirstOrDefault

Returns the first element of the sequence, or a default value if the sequence contains no elements.

FirstOrDefault(Predicate<T>)

Returns the first element of the sequence that satisfies the specified condition or a default value if no such element is found.

FirstOrDefault(Predicate<T>, T)

Returns the first element of the sequence that satisfies the specified condition or the specified default value if no such element is found.

FirstOrDefault(T)

Returns the first element of the sequence, or the specified default value if the sequence contains no elements.

ForEach(Action<T>)

Performs the specified action on each element of the sequence.

GetComparer

Returns the specified comparer for this instance.

GetCount
GetElementType
GetEnumerator

Returns an enumerator that iterates through the collection.

GetIsEmpty
GetNonEnumeratedCount

Attempts to determine the number of elements in the sequence without forcing an enumeration.

Intersect(IEnumerable<T>)

Produces the set intersection of two sequences by using the default equality comparer to compare values.

Intersect(IEnumerable<T>, IEqualityComparer<T>)

Produces the set intersection of two sequences by using the specified equality comparer to compare values.

Last

Returns the last element of the sequence.

Last(Predicate<T>)

Returns the last element of the sequence that satisfies the specified condition.

LastOrDefault

Returns the last element of the sequence, or a default value if the sequence contains no elements.

LastOrDefault(Predicate<T>)

Returns the last element of the sequence that satisfies the specified condition or a default value if no such element is found.

LastOrDefault(Predicate<T>, T)

Returns the last element of the sequence that satisfies the specified condition or the specified default value if no such element is found.

LastOrDefault(T)

Returns the last element of the sequence, or the specified default value if the sequence contains no elements.

Max

Returns the maximum value in the sequence.

Max(Func<T,Currency>)

Invokes a transform function on each element of the sequence and returns the maximum Currency value.

Max(Func<T,Double>)

Invokes a transform function on each element of the sequence and returns the maximum Double value.

Max(Func<T,Int64>)

Invokes a transform function on each element of the sequence and returns the maximum Int64 value.

Max(Func<T,Integer>)

Invokes a transform function on each element of the sequence and returns the maximum Integer value.

Max(Func<T,Single>)

Invokes a transform function on each element of the sequence and returns the maximum Single value.

Max(IComparer<T>)

Returns the maximum value in the sequence by using the specified comparer.

Max(TComparison<T>)

Returns the maximum value in the sequence by using the specified comparison.

Memoize

Returns a sequence that lazily caches the sequence as it is iterated for the first time, reusing the cache thereafter for future re-iterations. If the sequence is already cached or buffered then it is returned verbatim.

Min

Returns the minimum value in the sequence.

Min(Func<T,Currency>)

Invokes a transform function on each element of the sequence and returns the minimum Currency value.

Min(Func<T,Double>)

Invokes a transform function on each element of the sequence and returns the minimum Double value.

Min(Func<T,Int64>)

Invokes a transform function on each element of the sequence and returns the minimum Int64 value.

Min(Func<T,Integer>)

Invokes a transform function on each element of the sequence and returns the minimum Integer value.

Min(Func<T,Single>)

Invokes a transform function on each element of the sequence and returns the minimum Single value.

Min(IComparer<T>)

Returns the minimum value in the sequence by using the specified comparer.

Min(TComparison<T>)

Returns the minimum value in the sequence by using the specified comparison.

Ordered

Sorts the elements of the sequence in ascending order using the default comparer for their type.

Ordered(IComparer<T>)

Sorts the elements of the sequence in ascending order using the specified comparer.

Ordered(TComparison<T>)

Sorts the elements of the sequence in ascending order using the specified comparison.

Reversed

Inverts the order of the elements in the sequence.

Shuffled

Returns a sequence of elements in random order from the original.

Single

Returns the only element of the sequence, and raises an exception if there is not exactly one element in the sequence.

Single(Predicate<T>)

Returns the only element of the sequence that satisfies a specified condition, and raises an exception if more than one such element exists.

SingleOrDefault

Returns the only element of the sequence, or a default value if the sequence is empty; this method raises an exception if there is more than one element in the sequence.

SingleOrDefault(Predicate<T>)

Returns the only element of the sequence that satisfies a specified condition or a default value if no such element exists; this method raises an exception if more than one element satisfies the condition.

SingleOrDefault(Predicate<T>, T)

Returns the only element of the sequence that satisfies a specified condition, or a specified default value if no such element exists; this method raises an exception if more than one element satisfies the condition.

SingleOrDefault(T)

Returns the only element of the sequence, or a specified default value if the sequence is empty; this method raises an exception if there is more than one element in the sequence.

Skip(Integer)

Bypasses a specified number of elements in the sequence and then returns the remaining elements.

SkipLast(Integer)

Omits the specified number of elements at the end of the sequence.

SkipWhile(Func<T,Integer,Boolean>)

Bypasses elements in the sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function.

SkipWhile(Predicate<T>)

Bypasses elements in the sequence as long as a specified condition is true and then returns the remaining elements.

Sum

Computes the sum of the sequence.

Sum(Func<T,Currency>)

Computes the sum of the sequence of Currency values that are obtained by invoking a transform function on each element of the input sequence.

Sum(Func<T,Double>)

Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.

Sum(Func<T,Int64>)

Computes the sum of the sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.

Sum(Func<T,Integer>)

Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.

Sum(Func<T,Single>)

Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.

Take(Integer)

Returns the specified number of contiguous elements from the start of the sequence.

TakeLast(Integer)

Returns the specified number of contiguous elements from the end of the sequence.

TakeWhile(Func<T,Integer,Boolean>)

Returns elements from the sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function.

TakeWhile(Predicate<T>)

Returns elements from the sequence as long as a specified condition is true.

ToArray

Creates a new array which is filled with the elements in the collection.

TryGetElementAt(T, Integer)

Attempts to get the element at a specified index in the sequence.

TryGetFirst(T)

Attempts to get the first element in the sequence.

TryGetFirst(T, Predicate<T>)

Attempts to get the first element in the sequence that satisfies a specified condition.

TryGetLast(T)

Attempts to get the last element in the sequence.

TryGetLast(T, Predicate<T>)

Attempts to get the last element in the sequence that satisfies a specified condition.

TryGetSingle(T)

Attempts to get the only element in the sequence.

TryGetSingle(T, Predicate<T>)

Attempts to get the only element in the sequence that satisfies a specified condition.

Union(IEnumerable<T>)

Produces the set union of two sequences by using the default equality comparer.

Union(IEnumerable<T>, IEqualityComparer<T>)

Produces the set union of two sequences by using a specified equality comparer.

Where(Func<T,Integer,Boolean>)

Filters the sequence based on the specified predicate. Each element's index is used in the logic of the predicate function.

Where(Predicate<T>)

Filters the sequence based on the specified predicate.