CSharp examples for Language Basics:Data Type Cast
Converting a string to an array of chars.
using System;//w w w . ja va 2 s. com using System.Text; // Need for type UTF8Encoding. using System.Globalization; // Need for cultures. class Program { static void Main(string[] args) { // Converting a string to an array of chars. Console.WriteLine("Convert a string to an array of chars."); string custName = "Pam III Sphar"; char[] custNameChars = custName.ToCharArray(); foreach (char c in custNameChars) { Console.Write(c); } } }