Aggregate string and int value in CSharp

Description

The following code shows how to aggregate string and int value.

Example


   //w w w. j av a2  s.  c o m


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<string, int>(0,(a, b) => a + b.Length));
        }
    }

The code above generates the following result.





















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ