How to add char array to StringBuilder in C#

1 Answer

0 votes
using System;
using System.Text;

class Program
{
    static void Main() {
        char[] array = new char[]{'c', 'a', 'd', 'v', 'g'};
        
        StringBuilder sb = new StringBuilder();
        foreach (char ch in array) {
            sb.Append(ch);
        }

        Console.WriteLine(sb);
    }
}



/*
run:

cadvg

*/

 



answered Sep 11, 2020 by avibootz

Related questions

1 answer 296 views
1 answer 238 views
1 answer 290 views
1 answer 259 views
2 answers 334 views
1 answer 236 views
236 views asked Jan 15, 2017 by avibootz
1 answer 310 views
...