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);
精彩评论