开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜