开发者

Is there an equivalent for Enumerable.Empty<T> that returns IQueryable?

开发者 https://www.devze.com 2023-01-06 15:44 出处:网络
It\'s possible to do the followi开发者_如何学运维ng: IEnumerable<Person> people = Enumerable.Empty<Person>();

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消