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

Popular posts from this blog

Using Progress Bar In C#

Get elements by class name in javascript

Check if ViewBag is null or doesn't exist