Linq Take() question

Viewed 40810

I want to filter my results to take only the X amount of records. I am wondering how does Take() work?

On this site I found: http://www.hookedonlinq.com/TakeOperator.ashx

It says Take() "Throws an ArgumentNullException if source is null." So what should I do? I can't guarantee that everytime I do a Take() I will have some records in that table or not.

So do I first have to do a count? Then do another query to make sure there is some records to grab?

Also what happens if the I have a Take(2) but only 1 record will it throw this same exception?

4 Answers
Related