Most methods are chainable as in .NET context.
Here you can find the DOCUMENTATION in the wiki or the API documentation.
- PHP 5.5+ (because it uses Generator syntax)
A complete list can be found at the live example page.
Create a sequence from a list of values.
use \System\Linq;
$seq = Enumerable::fromValues(5979, 23979, null, 23979, 1781, 241279);
$newSeq = $seq->select(function($item) {
return strval($item);
}) // transform all values
// to string
->where(function($item) {
return !empty($item);
}) // filter out all values that are empty
->skip(1) // skip the first element ('5979')
->take(3) // take the next 3 elements from current position
// ('23979', '23979' and '1781')
->distinct() // remove duplicates
->order(); // sort
foreach ($newSeq as $item) {
// [0] '1781'
// [1] '23979'
}Create a sequence from any Iterator.
use \System\Linq;
function createIterator() {
yield 5979;
yield 23979;
yield 1781;
yield 241279;
}
$seq = new Enumerable(createIterator());
// ...- all()
- any()
- average()
- cast()
- concat()
- contains()
- count()
- defaultIfEmpty()
- distinct()
- elementAtOrDefault()
- except()
- firstOrDefault()
- groupBy()
- groupJoin()
- intersect()
- join()
- lastOrDefault()
- max()
- min()
- ofType()
- orderBy()
- orderByDescending()
- reverse()
- select()
- selectMany()
- sequenceEqual()
- singleOrDefault()
- skip()
- skipWhile()
- sum()
- take()
- takeWhile()
- toArray()
- toDictionary()
- toList()
- toLookup()
- union()
- where()
- zip()
- moveNext() method
