String Array To String Based On Any Delimiter In C#

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Runtime.InteropServices;  
  5. using System.Text;  
  6. using System.Threading.Tasks;  
  7. namespace ConsoleApplicationdemo  
  8. {  
  9.     class Program  
  10.     {  
  11.         static void Main(string[] args)  
  12.         {  
  13.             ///////////string array to string//////////////  
  14.             string[] arr = { "one""two""three" };  
  15.             string delimeter ="-";  
  16.             demo obj = new demo();  
  17.             obj.joinstring(delimeter, arr);  
  18.             Console.ReadKey();  
  19.         }  
  20.     }  
  21.     class demo  
  22.     {  
  23.         public void joinstring(string delimeter, string[] arr)  
  24.         {  
  25.             string joinitem = string.Join(delimeter, arr);  
  26.             Console.WriteLine(joinitem);  
  27.         }  
  28.     }  
  29. }