It's possible to do the followi开发者_如何学运维ng:
IEnumerable<Person> people = Enumerable.Empty<Person>();
Is there an equivalent for IQueryable...?
IQueryable<Person> people = Queryable.Empty<Person>();
try with this:
Enumerable.Empty<Person>().AsQueryable();
As you have already probably noticed there is no Queryable.Empty
extension method. You can simulate this by using other extensions methods, such as Where
:
var empty = collection.Where(c => false);
calling AsQueryable on the Empty Enumerable?
精彩评论