Question

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!

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top