1
Answer

Displaying character arrays

Peter Price

Peter Price

15y
3.3k
1
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)