LINQ Take(); how to handle when null or fewer records than requested available?

There’s a difference between a null reference and an empty collection. It’s fine to call Take on an empty collection. And the argument specifies a maximum number to take, so it’s also fine to specify more than there are items in the collection.

I recommend referring to MSDN for precise details like this.

For Linq to Objects: http://msdn.microsoft.com/en-us/library/bb503062.aspx

For Link to databases: http://msdn.microsoft.com/en-us/library/bb300906.aspx

Leave a Comment