IList to IQueryable

前端 未结 2 414
长情又很酷
长情又很酷 2020-12-01 12:07

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

Is this possible?

相关标签:
2条回答
  • 2020-12-01 12:13

    Use the AsQueryable<T>() extension method.

    0 讨论(0)
  • 2020-12-01 12:14
    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.

    0 讨论(0)
提交回复
热议问题