How to join a List of strings in C#

1 Answer

0 votes
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var list = new List<string>() { "c#", "java", "c", "c++" };
 
        string s = string.Join<string>(", ", list);
        
        Console.WriteLine(s);
    }
}


/*
run:
 
c#, java, c, c++
 
*/

 



answered Jan 20, 2017 by avibootz
edited May 4, 2025 by avibootz

Related questions

1 answer 98 views
1 answer 206 views
1 answer 73 views
1 answer 78 views
1 answer 103 views
...