Guest User

LINQ

a guest
May 7th, 2016
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.25 KB | None | 0 0
  1.     public static IEnumerable<char> Calculate(string stringValue)
  2.     {
  3.         return stringValue
  4.             .GroupBy(i=>i)
  5.             .Select(g=>new{Symbol=g.Key,Count=g.Count()})
  6.             .OrderByDescending(i=>i.Count)
  7.             .GroupBy(i=>i.Count)
  8.             .First()
  9.             .Select(g=>g.Symbol);
  10.     }
Advertisement
Add Comment
Please, Sign In to add comment