How to convert a char array to a string in C#
C# allows users to convert a character array (e.g., char[] arr) to a String.
Char arr[] to string
We can perform this conversion by passing the character array to a string constructor.
Consider the following syntax:
string str = new string (char_arr)
Code
In the code below, we have a character array arr that contains h e l l o. By using a built-in string constructor, we can convert this character array into a string.
class HelloWorld{static void Main(){char[] arr={'H','e','l','l','o'};string str = new string (arr);System.Console.WriteLine(str);}}
Free Resources
Copyright ©2025 Educative, Inc. All rights reserved