Making a custom class IQueryable

后端 未结 2 1653
广开言路
广开言路 2021-02-13 22:14

I have been working with the TFS API for VS2010 and had to query FieldCollection which I found isn\'t supported by LINQ so I wanted to create a custom class to make the Field an

2条回答
  •  自闭症患者
    2021-02-13 23:18

    If you want an object to be usable by LINQ, implement IEnumerable. IQueryable is overkill for LINQ to Objects. It is designed for converting the expressions into another form.

    Or if you want, you can do this

    FieldCollection someFieldCollection = ...
    IEnumerable fields = someFieldCollections.Cast();
    

提交回复
热议问题