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

Check if ViewBag is null or doesn't exist

Using Progress Bar In C#

Jquery serer side datatables in asp.net