Mega Code Archive

 
Categories / C# Tutorial / LINQ
 

Aggregation with integer value

using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; public class MainClass{    public static void Main(string[] args){             Int32[] TestData2 = { 1, 2, 3, 4, 5 };          var ThisQuery2 =TestData2.Aggregate((ThisElement, Next) => ThisElement + Next);          Console.WriteLine(ThisQuery2.ToString());    } }