Вопрос

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!

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top