-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Collections_EnumerableExtensions_AggregateOrDefault__2
andrewvk edited this page Jul 1, 2016
·
5 revisions
EnumerableExtensions.AggregateOrDefault(TSource, TAccumulate) Method (IEnumerable(TSource), TAccumulate, Func(TAccumulate, TSource, TAccumulate), Func(TAccumulate))
Applies an accumulator function over a sequence.
Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 1.1.0.0 (1.1.0.0)
C#
public static TAccumulate AggregateOrDefault<TSource, TAccumulate>(
this IEnumerable<TSource> source,
TAccumulate seed,
Func<TAccumulate, TSource, TAccumulate> func,
Func<TAccumulate> defaultSelector
)
VB
<ExtensionAttribute>
Public Shared Function AggregateOrDefault(Of TSource, TAccumulate) (
source As IEnumerable(Of TSource),
seed As TAccumulate,
func As Func(Of TAccumulate, TSource, TAccumulate),
defaultSelector As Func(Of TAccumulate)
) As TAccumulate
F#
[<ExtensionAttribute>]
static member AggregateOrDefault :
source : IEnumerable<'TSource> *
seed : 'TAccumulate *
func : Func<'TAccumulate, 'TSource, 'TAccumulate> *
defaultSelector : Func<'TAccumulate> -> 'TAccumulate
- source
- Type: System.Collections.Generic.IEnumerable(TSource)
An IEnumerable(T) to aggregate over. - seed
- Type: TAccumulate
The initial accumulator value. - func
- Type: System.Func(TAccumulate, TSource, TAccumulate)
An accumulator function to be invoked on each element. - defaultSelector
- Type: System.Func(TAccumulate)
A function to select default value if the source is empty.
- TSource
- The type of the elements of source.
- TAccumulate
- The type of the accumulator value.
Type: TAccumulate
The final accumulator value.
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(TSource). 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).
EnumerableExtensions Class
AggregateOrDefault Overload
CodeJam.Collections Namespace