8

.NET CF 似乎缺少非常有用的 Reflection.Emit。到目前为止,我找到了这个库作为替代方案:http: //www.codeplex.com/EmitCF

但是它似乎是一个废弃的早期版本,所以我正在寻找更多选择。

有人知道 Emit 的另一种选择吗?或者也许有人使用了 EmitCF 并且可以评论它的状态?

顺便说一句,更大的图景:我正在尝试为 CF 获取 Emit,以便我可以让http://dynamic.codeplex.com在 CF 下工作,所以我可以优化我正在使用的序列化代码(http ://www.codeproject.com/KB/XML/GR_CustomXmlSerializer.aspx )

4

2 回答 2

5

您需要的是 Cecil ( http://mono-project.com/Cecil ),这是一个 Mono 项目库,用于生成和检查 CIL 格式的程序和库。它得到积极维护,比 Reflection.Emit 做得更多,并且在很多项目中使用,包括一些以 .NET CF 为目标的项目。

于 2009-09-09T00:03:42.640 回答
1

This isn't exactly an answer to your question, but since Reflection.Emit isn't supported in CF, an alternative approach you could take to serialization/deserialization would be to compile your classes into a regular Windows application, and make use of Reflection.Emit to programatically generate serialize and de-serialize methods for each class, which could then be incorporated back into the class in the CF version. Basically, you'd use Reflection.Emit in the full framework for code generation.

This would be more work (and a constant source of more work, of course), but it would perform better than a dynamic, Reflection.Emit-based approach (which doesn't work in CF anyway). Most CF classes will work unchanged in the full framework, although not necessarily, of course.

于 2009-09-09T14:27:14.907 回答