Sum with Linq : Sum « LINQ « VB.Net






Sum with Linq

  
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Linq
Imports System.Text
Imports System.Globalization

Module Example
   Public Sub Main()
      Dim TestArray As Integer() = New Integer() {1, 2, 3, 4}
      Dim ThisQuery = Aggregate TheResult In TestArray Into Sum(TheResult)

      Console.WriteLine("Sum: " + ThisQuery.ToString())

   End Sub 
End Module 

   
    
  








Related examples in the same category

1.Alternative Syntax for Sum
2.Using Sum to get the total units in stock for each project category
3.Using Aggregating Sum to get the total of the numbers in an array
4.Using Aggregating Sum to get the total number of characters of all words