The lack of expression trees in Compact Framework has bugged me for some time now, but I haven't really looked for a solution.
Today, I've fo开发者_JAVA百科und a blog post about an alternative System.Linq.Expressions built on top of Mono System.Core and used e.g. by db4o (you can find it here).
My question is - have you used this library and if so, what were your experiences with it (especially regarding performance)?
For LINQ to db4o, System.Linq.Expressions works pretty well. It likely won't be the bottleneck of a Compact Framework application querying a non LINQ to objects source.
If you're just using it for doing some meta-programming, using Compile over and and over, it won't perform as well as on the desktop, as it's basically a reflection based interpreter. For what it's worth, the interpreter passes the full Mono test suite for Expression Trees (it's quite consequent).
The only know bug with it is related to a missing feature of the Compact Framework BCL, making it impossible for csc to emit a proper expression tree when generic fields are involved.
This doesn't directly answer your question, but you may find it interesting. IronPython and IronRuby ship with the source code for the .NET 4.0 implementation of System.Linq.Expressions. They also have an interpreter for Linq/DLR Expression Trees. Tomáš Matoušek was able to make IronRuby work on a Windows Phone emulator using this interpreter.
精彩评论