string str = @"dsssaa"; var result1 = (from p in str.ToCharArray() group p by p into gr orderby gr.Count() descending select new { CharKey = gr.Key, CharCount = gr.Count() } ).FirstOrDefault(); if (result1 != null) { Console.WriteLine("CharKey:" + result1.CharKey.ToString()); Console.WriteLine("CharCount:" + result1.CharCount.ToString()); } var result2 = str.ToCharArray().GroupBy(p=>p) .OrderByDescending(p=>p.Count()) .Select(p=>new {CharKey=p.Key,CharCount=p.Count()}) .FirstOrDefault(); if (result2 != null) { Console.WriteLine("CharKey:" + result2.CharKey.ToString()); Console.WriteLine("CharCount:" + result2.CharCount.ToString()); } Dictionary<char, int> dic = new Dictionary<char, int>(); foreach (char ch in str.ToCharArray()) { if (dic.Keys.Contains(ch)) { dic[ch]++; } else { dic.Add(ch, 1); } } if (dic.Keys.Count > 0) { char charKey = dic.First().Key; int charCount = dic.First().Value; foreach(var item in dic) { if (item.Value > charCount) { charKey = item.Key; charCount = item.Value; } } Console.WriteLine("CharKey:" + charKey.ToString()); Console.WriteLine("CharCount:" + charCount.ToString()); }