class Program
{
static void Main(string[] args)
{
string str = "Hello My Friend";
Test(str, "H");
Console.ReadKey();
}
static void Test(string s,string searchStr)
{
searchStr = searchStr.ToLower();
int res = s.Where(x => x.ToString().ToLower() == searchStr).Count();
Console.WriteLine("{0} {1}",searchStr,res);
}
} |