IList<T> to IQueryable<T>

混江龙づ霸主 提交于 2019-11-26 14:10:06

问题


I have an List and I'd like to wrap it into an IQueryable.

Is this possible?


回答1:


List<int> list = new List<int>() { 1, 2, 3, 4, };
IQueryable<int> query = list.AsQueryable();

If you don't see the AsQueryable() method, add a using statement for System.Linq.




回答2:


Use the AsQueryable<T>() extension method.



来源:https://stackoverflow.com/questions/73542/ilistt-to-iqueryablet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!