Aggregation with string value : Aggregate « LINQ « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;


public class MainClass{

   public static void Main(string[] args){   
         String[] TestData = {"One", "Two", "Three", "Four",
                              "Five", "Six", "Seven", "Eight", 
                              "Nine", "Ten"};

         var ThisQuery = TestData.Aggregate((ThisElement, Next) => ThisElement + "\r\n" + Next);

         Console.WriteLine(ThisQuery);
   }
}








22.16.Aggregate
22.16.1.Use Aggregate on an array
22.16.2.Use Aggregate on an array with tenary operator
22.16.3.Aggregate Prototype
22.16.4.Aggregate and Sum
22.16.5.Aggregate for string length
22.16.6.Aggregate string and int value
22.16.7.Aggregate three values
22.16.8.Aggregate two string values
22.16.9.Aggregation with integer value
22.16.10.Aggregation with string value
22.16.11.Use Linq Aggregate the reverse a string