How can I reuse expressions within LINQ statements?

后端 未结 4 1601
南笙
南笙 2020-12-14 17:03

I like to reuse expressions for DRY reasons, but how do I reuse the expressions within a LINQ statement?

e.g.

I have

public static class MyE         


        
4条回答
  •  别那么骄傲
    2020-12-14 17:22

    By the way, I've come across this useful article which explains how you can create dynamic LINQ Queries that reference functions wrapped as Expressions using a custom ToExpandable() extension method. The solution provided can be used within the various parts of a LINQ Query all while preserving the use of comprehension syntax instead of resorting to lambda syntax.

提交回复
热议问题