Get character array from string in C#
To get a char array from string we use ToCharArray method.
Overloads
This method has one overload which takes two parameters. First is StartIndex and second is Length.
Return Type
Return type of this method is char array.
string str = "I like rain";
char[] arr = str.ToCharArray();
foreach(char c in arr)
{
Console.WriteLine(c);
}
Comments
Post a Comment