C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String ToCharArray()The C# ToCharArray() method is used to get character array from a string object. Signaturepublic char[] ToCharArray() public char[] ToCharArray(Int32, Int32) ParameterFirst method does not take any parameter while second method takes two integer parameters. ReturnIt returns a character array. C# String ToCharArray() Method Example
using System;
public class StringExample
{
public static void Main(string[] args)
{
string s1 = "Hello C#";
char[] ch = s1.ToCharArray();
foreach(char c in ch){
Console.WriteLine(c);
}
}
}
Output: H e l l o C #
Next TopicC# String ToLower()
|