1
Reply

Displaying character arrays

Peter Price

Peter Price

Apr 16 2009 12:52 AM
3.3k
How do I display a character array?  I copy a string to a character array using the 'CopyTo' method, but when I attempt to display the character array in any of the following ways:
   Console.WriteLine("2nd char_array value is {0}", char_array); 
   Console.WriteLine("3rd char_array value is " + Convert.ToString(char_array));
   string newstring;
   newstring = Convert.ToString(char_array);
   Console.WriteLine("4th char_array value is " + newstring);

I get the results:
2nd char_array value is System.Char[]
3rd char_array value is System.Char[]
4th char_array value is System.Char[]
 
Instead of the value in char_array.

Thanks for your help.

Peter Price







Answers (1)