snippetcsharpCritical
.NET / C# - Convert char[] to string
Viewed 0 times
netstringconvertchar
Problem
What is the proper way to turn a
The
char[] into a string?The
ToString() method from an array of characters doesn't do the trick.Solution
There's a constructor for this:
char[] chars = {'a', ' ', 's', 't', 'r', 'i', 'n', 'g'};
string s = new string(chars);Code Snippets
char[] chars = {'a', ' ', 's', 't', 'r', 'i', 'n', 'g'};
string s = new string(chars);Context
Stack Overflow Q#1324009, score: 886
Revisions (0)
No revisions yet.