Aggregate two string values in CSharp

Description

The following code shows how to aggregate two string values.

Example


   /*  w w  w.  j av a2 s .  c  om*/



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

    class Program
    {
        static void Main(string[] args)
        {
            string[] curries = { "abc", "abcd", "ab" };
            Console.WriteLine(curries.Aggregate((a, b) => a + " " + b));
        }
    }

The code above generates the following result.





















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ