Select most frequent value using LINQ
var mostFollowedQuestions = context.UserIsFollowingQuestion
.GroupBy(q => q.QuestionId)
.OrderByDescending(gp => gp.Count())
.Take(5)
.Select(g => g.Key).ToList();
int[] nums = new[] { 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7 };
IEnumerable<int> top5 = nums
.GroupBy(i => i)
.OrderByDescending(g => g.Count())
.Take(5)
.Select(g => g.Key);