Concatenate or Join a string Array using LINQ in C#


This content was proof-read by Grammarly. You can Try Grammary for FREE

Want to join the items inside the string array say with, delimiter using LINQ in C#? It’s pretty easy.

Below is a sample code snippet demonstrating in easy steps on how to concatenate a string array using LINQ in C#?

Concatenate or Join a string Array using LINQ in C#

using System;

using System.Collections.Generic;

using System.Data;

using System.Linq;

namespace AbundantCode

{

internal class Program

{

//Concatenate or Join a string Array using LINQ in C#

private static void Main(string[] args)

{

string[] AbundantArray = new string[] { "Abundantcode", "is", "a sourcecode site" };

var result = AbundantArray.Aggregate((m, n) => m + "," + n);

Console.WriteLine(result);

Console.ReadLine();

}

}

}
Concatenate or Join a string Array using LINQ in C#
Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

%d bloggers like this: