Pergunta

I know I can walk a linq expression tree and emit the IL code by myself. But i'm trying to avoid that. In this case, using the CodeDom or the Roslyn compiler is not an option (I have to start from an existing set of linq expressions generated by a propietary DSL). Any ideas? Thanks!

Foi útil?

Solução

You can compile an expression to an assembly by using CompileToMethod(). This has some restrictions, most notably that the MethodBuilder that you pass to the method has to be for a static method. But otherwise this should be exactly what you're asking for.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top