How to convert a char array to stringĀ in c# or vb.net?
Sample C#
char[] myCharArray = { 'H', 'e', 'l', 'l', 'o', ',', 'W', 'o', 'r', 'l', 'd' }; string newString = new string(myCharArray);
Sample VB.NET
Dim myCharArray As Char() = {"H", "e", "l", "l", "o", ",", "W", "o", "r", "l", "d"} Dim newString As New String(myCharArray)
For more informations take a look at the String Class Constructor’s in the msdn.
This is how you can convert a string to a char array:
string text = “test”;
char[] a = text.ToCharArray();