This Sample Allows you to use the aggregate function on arrays
Sub Main() Dim numbers() As Integer = {10, 20, 33, 44, 33}
Dim sumAgg = numbers.Aggregate(Function(n, m) n + m) Dim proAgg = numbers.Aggregate(Function(n, m) n * m) Dim subAgg = numbers.Aggregate(Function(n, m) n - m) Console.WriteLine("Sum Using Aggregate : " & sumAgg) Console.WriteLine("Product Using Aggregate : " & proAgg) Console.WriteLine("Subtraction Using Aggregate : " & subAgg) 'Similarly you can add any math's calculation to these arrays 'ArrayName.Aggregate(Function(a,b) a [operator] b)
End Sub
Only Works on Framework 3.5
Regards Hefin Dsouza
|
No responses found. Be the first to respond and make money from revenue sharing program.
|