AggregateRightExtensionAggregateRightTSource, TAccumulate, TResult(IEnumerableTSource, TAccumulate, FuncTSource, TAccumulate, TAccumulate, FuncTAccumulate, TResult) Method
Namespace: MoreLinq.ExtensionsAssembly: MoreLinq (in MoreLinq.dll) Version: 4.4.0+6d97c3b1d482f98300f4446df14742b0e3fafbec
public static TResult AggregateRight<TSource, TAccumulate, TResult>(
this IEnumerable<TSource> source,
TAccumulate seed,
Func<TSource, TAccumulate, TAccumulate> func,
Func<TAccumulate, TResult> resultSelector
)
<ExtensionAttribute>
Public Shared Function AggregateRight(Of TSource, TAccumulate, TResult) (
source As IEnumerable(Of TSource),
seed As TAccumulate,
func As Func(Of TSource, TAccumulate, TAccumulate),
resultSelector As Func(Of TAccumulate, TResult)
) As TResult
public:
[ExtensionAttribute]
generic<typename TSource, typename TAccumulate, typename TResult>
static TResult AggregateRight(
IEnumerable<TSource>^ source,
TAccumulate seed,
Func<TSource, TAccumulate, TAccumulate>^ func,
Func<TAccumulate, TResult>^ resultSelector
)
[<ExtensionAttribute>]
static member AggregateRight :
source : IEnumerable<'TSource> *
seed : 'TAccumulate *
func : Func<'TSource, 'TAccumulate, 'TAccumulate> *
resultSelector : Func<'TAccumulate, 'TResult> -> 'TResult
- source IEnumerableTSource
- Source sequence.
- seed TAccumulate
- The initial accumulator value.
- func FuncTSource, TAccumulate, TAccumulate
- A right-associative accumulator function to be invoked on each element.
- resultSelector FuncTAccumulate, TResult
- A function to transform the final accumulator value into the result value.
- TSource
- The type of the elements of source.
- TAccumulate
- The type of the accumulator value.
- TResult
- The type of the resulting value.
TResultThe transformed final accumulator value.In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This operator executes immediately.
var numbers = Enumerable.Range(1, 5);
int result = numbers.AggregateRight("6", (a, b) => $"({a}/{b})", str => str.Length);
The
result variable will contain
21.