string index of char count c# code example
Example 1: c# count number of occurrences in string
char myChar = 'x';
string myString = "xyz";
int count = myString.Count(s => s == myChar);
Example 2: strinng.indexOf c#
int index = String.IndexOf(char x);
int index = String.IndexOf(string x);