Click here to Skip to main content
12,066,448 members (56,433 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
How to convert any array of char to string format???
Posted 11-Oct-12 8:20am
Edited 11-Oct-12 10:35am
CPallini374.4K
v2
Comments
Sergey Alexandrovich Kryukov 11-Oct-12 17:13pm
   
What's broken? MSDN? Google? Bing?
--SA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Easiest way is just use the string constuctor:
var chars = new[] {  'a', 'b', 'c', 'd'  };
var str = new string(chars);
  Permalink  
Comments
ridoy 11-Oct-12 15:45pm
   
+5
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

//chars is ur char array
string s = new string(chars);
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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();
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160208.1 | Last Updated 11 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100