Getting Started with Adobe After Effects - Part 6: Motion Blur
This module helps you to share, discuss and learn interview questions and answers of different technologies

C# - Write a linq query to get top 5 records?

Apr 7 2012 12:00AM by Ramireddy   

Question

By using Linq, how can you get top 5 records?

Answer

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 ·  ·  ·  · 


Ramireddy
2 · 40% · 12972
0
Liked
 
0
Asked



Submit

Your Comment


Sign Up or Login to post a comment.

"C# - Write a linq query to get top 5 records?" rated 5 out of 5 by 9 readers
C# - Write a linq query to get top 5 records? , 5.0 out of 5 based on 9 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]