Click here to Skip to main content
14,837,097 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
How to convert any array of char to string format???
Posted
Updated 11-Oct-12 9:35am
v2
Comments
Sergey Alexandrovich Kryukov 11-Oct-12 17:13pm
   
What's broken? MSDN? Google? Bing?
--SA

Easiest way is just use the string constuctor:
C#
var chars = new[] {  'a', 'b', 'c', 'd'  };
var str = new string(chars);
   
Comments
ridoy 11-Oct-12 15:45pm
   
+5
//chars is ur char array
C#
string s = new string(chars);
   
v2
C#
char[] chars = { 'a', 'b', 'c', 'd' };
string[] str = new string[chars.Length];
for (int i = 0; i < chars.Length; i++)
{
    str[i] = chars[i].ToString();
    Console.WriteLine(str[i]);
}
Console.ReadLine();
   
Comments
CPallini 11-Oct-12 15:35pm
   
Uhm...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900