Alex Rivera | Logout

LINQ results when there are no matches?

Asked 2009-10-07T17:48:17.783
10

What exactly does a LINQ function return when there are no matches? Take the Where method, for example:

var numbers = Enumerable.Range(1, 10);
var results = numbers.Where(n => n == 50);

What would be in results at this point?

Edit
Report

1 Answer

4

In this case it returns an IEnumerable<Int32> with a count of 0 items.

answered 2009-10-07T17:50:47.793

Your Answer