开发者

Get top 3 records form a IList +C#

i have a iList which has some records .I need to get top 3 records from it . Is 开发者_StackOverflow中文版there any way to do this with 'LINQ'?


How about

IList<string> list = new List<string> { "5", "4", "3", "2", "1"};
var results = list.OrderBy(x => x).Take(3);


myList.OrderBy(i => {your criteria for "top" goes here}).Take(3);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜