How to convert array to StringBuilder in C#

1 Answer

0 votes
using System;
using System.Text;

class Program
{
    static void Main() {
        string[] arr = {"c#", "c", "c++",  "php"};
        
        StringBuilder sb = new StringBuilder();
        foreach (string s in arr) {
            sb.Append(s).Append(" ");
        }

        Console.WriteLine(sb);
    }
}



/*
run:

c# c c++ php 

*/

 



answered Sep 10, 2020 by avibootz

Related questions

1 answer 131 views
131 views asked Nov 18, 2021 by avibootz
1 answer 177 views
3 answers 370 views
370 views asked Feb 24, 2015 by avibootz
1 answer 131 views
131 views asked Sep 11, 2020 by avibootz
1 answer 165 views
1 answer 186 views
1 answer 240 views
...