\Enumerable

Provides a set of static (Shared in Visual Basic) methods for querying objects that implement IEnumerable<T>.

Summary

Methods
Properties
Constants
OrderBy()
OrderByDescending()
OrderByKey()
OrderByKeyDescending()
Select()
GroupBy()
ToDictionary()
Last()
Where()
SkipWhile()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

OrderBy()

OrderBy(array  $array, \function  $key) : array

Sorts the elements of a sequence in ascending order according to a key.

Parameters

array $array

A sequence of values to order.

\function $key

A function to extract a key from an element.

Returns

array —

An System.Linq.IOrderedEnumerable<T> whose elements are sorted according to a key.

OrderByDescending()

OrderByDescending(  $array,   $key) : array

Sorts the elements of a sequence in descending order according to a key.

Parameters

$array
$key

Returns

array —

An System.Linq.IOrderedEnumerable whose elements are sorted in descending order according to a key.

OrderByKey()

OrderByKey(  $array,   $key) 

Parameters

$array
$key

OrderByKeyDescending()

OrderByKeyDescending(  $array,   $key) 

Parameters

$array
$key

Select()

Select(array  $table, string|\function  $selector) : array

Projects each element of a sequence into a new form.

Parameters

array $table

A sequence of values to invoke a transform function on.

string|\function $selector

A transform function to apply to each element.

Returns

array —

An System.Collections.Generic.IEnumerable whose elements are the result of invoking the transform function on each element of source.

GroupBy()

GroupBy(array  $array, string  $key) : array

Groups the elements of a sequence

Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function.

Parameters

array $array

An System.Collections.Generic.IEnumerable whose elements to group.

string $key

A function to extract the key for each element.

Returns

array —

A collection of elements of type TResult where each element represents a projection over a group and its key.

ToDictionary()

ToDictionary(array  $source, string  $key,   $element = NULL) : array

Creates a System.Collections.Generic.Dictionary<T1,T2> from an System.Collections.Generic.IEnumerable<T> according to specified key selector and element selector functions.

Parameters

array $source

An System.Collections.Generic.IEnumerable to create a System.Collections.Generic.Dictionary<T1,T2> from.

string $key

A function to extract a key from each element.

$element

Returns

array —

A System.Collections.Generic.Dictionary<T1,T2> that contains values of type TElement selected from the input sequence.

Last()

Last(array  $source) : mixed

Returns the last element of a sequence.

Parameters

array $source

An System.Collections.Generic.IEnumerable to return the last element of.

Returns

mixed —

The value at the last position in the source sequence.

Where()

Where(  $source,   $predicate) 

Parameters

$source
$predicate

SkipWhile()

SkipWhile(  $source,   $predicate) 

Parameters

$source
$predicate