« MoreLINQ » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
Aucun résumé des modifications
Ligne 4 : Ligne 4 :
* [https://github.com/morelinq/examples Examples]
* [https://github.com/morelinq/examples Examples]
* [https://morelinq.github.io/3.1/ref/api/html/Methods_T_MoreLinq_MoreEnumerable.htm Documentation]
* [https://morelinq.github.io/3.1/ref/api/html/Methods_T_MoreLinq_MoreEnumerable.htm Documentation]
= Add =
<kode lang='bash'>
dotnet add package MoreLINQ
</kode>


= Operators =
= Operators =
== [https://github.com/morelinq/examples/blob/master/m/acquire.md#acquire Acquire] ==
== [https://github.com/morelinq/examples/blob/master/m/acquire.md#acquire Acquire] ==
Ensures that a sequence of disposable objects are all acquired successfully.
Ensures that a sequence of disposable objects are all acquired successfully.
== [https://github.com/morelinq/examples/blob/master/m/aggregate.md Aggregate] ==
== [https://github.com/morelinq/examples/blob/master/m/aggregate-right.md AggregateRight] ==
This operator is the right-associative version of the Aggregate LINQ operator.
<kode lang='cs'>
// 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))))
</kode>

Version du 14 novembre 2020 à 22:14

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))))