Click here to Skip to main content
Rate this: bad
good
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
CPallini329.3K
v2
Comments
Sergey Alexandrovich Kryukov at 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 at 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 at 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
0 Sergey Alexandrovich Kryukov 450
1 OriginalGriff 220
2 DamithSL 130
3 Dave Kreskowiak 120
4 Suvendu Shekhar Giri 110
0 OriginalGriff 7,645
1 DamithSL 5,614
2 Sergey Alexandrovich Kryukov 5,344
3 Maciej Los 4,961
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 11 Oct 2012
Copyright © CodeProject, 1999-2014
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