Cannot implicitly convert type 'System.Collections.Generic.List' to 'System.Linq.IQueryable'

后端 未结 1 1632
暗喜
暗喜 2021-02-08 11:58

I am trying to create a query in my domain service (VS 2010 Silverlight Business Application) that returns the results from inspection readings that came out as a specific value

1条回答
  •  粉色の甜心
    2021-02-08 12:17

    The problem is precisely because you've called ToList(). You've declared that you're returning IQueryable, and List doesn't implement IQueryable.

    Options (pick one):

    • Remove the ToList call
    • Change the return type to IEnumerable, IList or possibly List
    • Call AsQueryable() after ToList():

      ... as before ...
      .ToList().AsQueryable();
      

    Note that you don't need the type argument in the ToList call - it's the same one that the compiler would infer anyway.

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