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 149 views
149 views asked Nov 18, 2021 by avibootz
1 answer 187 views
3 answers 390 views
390 views asked Feb 24, 2015 by avibootz
1 answer 143 views
143 views asked Sep 11, 2020 by avibootz
1 answer 175 views
1 answer 205 views
1 answer 256 views
...