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 186 views
1 answer 129 views
1 answer 179 views
1 answer 169 views
2 answers 220 views
1 answer 130 views
130 views asked Jan 15, 2017 by avibootz
1 answer 210 views
...