-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Collections_EnumerableExtensions_AggregateOrDefault__2_1
Andrew Koryavchenko edited this page Jun 17, 2018
·
5 revisions
EnumerableExtensions.AggregateOrDefault(TSource, TAccumulate) Method (IEnumerable(TSource), TAccumulate, Func(TAccumulate, TSource, TAccumulate), TAccumulate)
Applies an accumulator function over a sequence.
Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0
C#
public static TAccumulate AggregateOrDefault<TSource, TAccumulate>(
this IEnumerable<TSource> source,
TAccumulate seed,
Func<TAccumulate, TSource, TAccumulate> func,
TAccumulate defaultValue = null
)
VB
<ExtensionAttribute>
Public Shared Function AggregateOrDefault(Of TSource, TAccumulate) (
source As IEnumerable(Of TSource),
seed As TAccumulate,
func As Func(Of TAccumulate, TSource, TAccumulate),
Optional defaultValue As TAccumulate = Nothing
) As TAccumulate
F#
[<ExtensionAttribute>]
static member AggregateOrDefault :
source : IEnumerable<'TSource> *
seed : 'TAccumulate *
func : Func<'TAccumulate, 'TSource, 'TAccumulate> *
?defaultValue : 'TAccumulate
(* Defaults:
let _defaultValue = defaultArg defaultValue null
*)
-> '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. - defaultValue (Optional)
- Type: TAccumulate
Default value returned 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