views:

82

answers:

2

I'm working with Linq expression trees (from the db4o/Mainsoft/Mono port) on the Compact Framework. Since System.Reflection.Emit doesn't exist, I can't compile my LambdaExpressions into delegates, which I want to do for performance reasons.

I thought maybe I could transform my expression tree into IL and basically provide the missing Emit functionality that way, but then I realized that I'd have to either run a WinCE-based ILASM on it or write my own PE headers and assmebly metadata.

I'd much rather have ILASM available. Is it?

+1  A: 

If you want use a Lambda-Expressions on CF you don't need ILASM or System.Reflection.Emit. The C# compiler for CF supports Lamba-Expressions but the CF base libraries does not have the Expressions classes. If you add reference to assembly with correct named (and correct implemented) classes for expressions, you enable Lambda-Expressions.

Thanks for god, there are this assembly already implemented ( http://evain.net/blog/articles/2008/09/22/linq-expression-trees-on-the-compact-framework ) - I use it with Db4O data access and for SqlCE wit LINQ IQueryableToolkit, and it works well.

TcKs
I'm using a modified version of that very port of System.Linq.Expressions. I still want to compile the LambdaExpression, though, since interpreting them makes me worry about performance.
codekaizen
And did you made some performance tests? I haven't any problem with it.
TcKs
Yes - initial user testing indicates performance issues.
codekaizen
+2  A: 

Apparently, I can compile Mono.Cecil for use under the Compact Framework, which will allow me to emit and load assemblies.

codekaizen