You can use following solutions
var str="this is my string";
int characterCount;
characterCount = str.Length - str.Replace("s", "").Length;
characterCount = str.Split('s').Length - 1;
characterCount = str.ToCharArray().Count(c => c == 's');
Posted On:
02-Sep-2017 06:28