MoreLINQ

De Banane Atomic
Aller à la navigationAller à la recherche

Links

Add

Bash.svg
dotnet add package MoreLINQ

Operators

Acquire

Ensures that a sequence of disposable objects are all acquired successfully.

Aggregate

AggregateRight

This operator is the right-associative version of the Aggregate LINQ operator.

Cs.svg
// LINQ left-associative aggregate
var result1 = Enumerable
    .Range(1, 5)
    .Select(i => i.ToString())
    .Aggregate((current, next) => string.Format("({0} > {1})", current, next));
// ((((1 > 2) > 3) > 4) > 5)

// MoreLINQ right-associative aggregate
var v2 = Enumerable
    .Range(1, 5)
    .Select(i => i.ToString())
    .AggregateRight((current, next) => string.Format("({0} > {1})", current, next));
// (1 > (2 > (3 > (4 > 5))))