Sunday, October 21, 2018

.NET / C# - Convert char[] to string



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.


Answer



char[] chars = {'a', ' ', 's', 't', 'r', 'i', 'n', 'g'};
string s = new string(chars);


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...