What is the proper way to turn a char[]
into a string?
The ToString()
method from an array of characters doesn't do the trick.
There's a constructor for this:
char[] chars = {'a', ' ', 's', 't', 'r', 'i', 'n', 'g'}; string s = new string(chars);
Use the constructor of string which accepts a char[]
char[] c = ...; string s = new string(c);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With