Reputation: 4319
How do I test if a Linq to SQL query returns no rows?
Upvotes: 4
Views: 4663
Reputation: 564333
You can use results.Any(); (the Queryable.Any method).
results.Any();
Upvotes: 0
Reputation: 77536
The .Any() LINQ operator:
.Any()
results.Any()
Returns false if there are no rows.
Upvotes: 8