开发者

How to select the first three elements of a IEnumerable object?

That's it. The question is in the title

I was looking for a cleaner way than the u开发者_运维问答sing for...break;

thanks


This should do it!

var items = new List<int>(){ 1, 2, 3, 4, 5 };
var results = items.Take(3);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜