你好,
>>但是我想,仅仅要用它执行字符串化的linq语句,同时返回结果集的话,使用CodeDom要如何做到?
CodeDOM 提供了表示许多常见的源代码元素类型的类型。您可以设计一个生成源代码模型的程序,使用 CodeDOM 元素
构成一个对象图。可以使用受支持的编程语言的 CodeDOM 代码生成器,将该对象图呈现为源代码
>>另外有个就是LINQ
Dynamic,但是不知道怎么使用它去筛选泛型集合里的数据,演示代码看不明白,
如果你要是linq动态查询泛型集合, 建议使用LINQ Dynamic, 它的语法有点类似SQL 语句。 比如你贴的那个的意思类似于下面的SQL语句
select * from products where categoryid=2 and unitprice>3 order by supplierid
另外,你也可以同lamaba表达式,来定制自己的动态查询。下面的文章提供相关的例子,你可以参考一下。
https://www.codeproject.com/Tips/582450/Build-Where-Clause-Dynamically-in-Linq
Best regards,
Cole Wu
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.