Home > DeveloperSection > Forums > String Join Method in c#
Ankit Singh

Total Post:341

Points:2389
Posted on    December-07-2015 9:57 PM

 C# C#  String 
Ratings:


 1 Reply(s)
 326  View(s)
Rate this:
I want to use String Join Method  in c# please help me.


aditya kumar Patel

Total Post:242

Points:1722
Posted on    December-07-2015 9:59 PM

The string.Join method combines many strings into one. It receives two arguments: an array or IEnumerable and a separator string. It places the separator between every element of the collection in the returned string.

using System;

class Program
{
    static void Main()
    {
        string[] arr = { "aditya", "pawan", "pankaj","suresh","sunil","suman","vrijesh","vikash","manoj" };

        Console.WriteLine(string.Join(",", arr));    
        Console.WriteLine(String.Join(",", arr));
        Console.Read();
    }
}

 


Don't want to miss updates? Please click the below button!

Follow MindStick