The next category in aggregate
operator of LINQ is Aggregate operator which is used in by Two ways simple
Aggregate , Aggregate Seed. In this article we discuss about these two
categories.
EXAMPLE CODE
Module Module1
Sub Main()
Dim DecimalNo() = {3.5, 7.8, 56.8, 8.9, 43.6}
Dim Multiplication = DecimalNo.Aggregate( _
Function(runningProduct, nextFactor) runningProduct * nextFactor)
Console.WriteLine("Total Multiplication of all numbers: {0}", Multiplication)
Console.ReadLine()
End Sub
End Module
OUTPUT
Read more articles related LINQ Click Here
EXAMPLE CODE
Module Module1
Sub Main()
Dim OpiningBalance = 200.0
Dim StratWithdraws() = {40, 20, 80, 100, 20, 140, 60}
Dim ClosingBalance = StratWithdraws.Aggregate(OpiningBalance, Function(Opening, Withdrawal) _
(If(Withdrawal <= Opening, (Opening - Withdrawal), Opening)))
Console.WriteLine("Closing balance: {0}", ClosingBalance)
Console.ReadLine()
End Sub
End Module
OUTPUT
Read more articles related LINQ Click Here