By using Linq, how can you get top 5 records?
By using Take function, we can get the top 5 records
int[] grades = { 59, 82, 70, 56, 92, 98, 85 }; // Sort the grades in descending order and take the first three. IEnumerable<int> topThreeGrades = grades.AsQueryable().OrderByDescending(grade => grade).Take(5);
Read More..   [150 clicks]
Published under: C# Interview Questions and Answers · · · ·