Compact Framework 的 Reflection.Emit 替代方案

发布于 2024-08-03 18:57:12 字数 601 浏览 2 评论 0 原文

看来.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)

It seems that .NET CF is missing the very useful Reflection.Emit.
So far, I found this library as an alternative: http://www.codeplex.com/EmitCF.

However it seems to be an abandoned early version, so I'm looking for more options.

Does anyone know of another alternative to Emit?
Or perhaps someone used EmitCF and can comment on its status?

BTW, the bigger picture: I'm trying to get Emit for the CF, so that I can get http://dynamic.codeplex.com to work under the CF, so I can optimize the serialization code I'm using (http://www.codeproject.com/KB/XML/GR_CustomXmlSerializer.aspx)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寻找一个思念的角度 2024-08-10 18:57:12

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

What you need is Cecil (http://mono-project.com/Cecil), a Mono project library to generate and inspect programs and libraries in CIL format. It's actively maintained, does a lot more than Reflection.Emit and it's used in a lot of projects, including some that target .NET CF.

提笔落墨 2024-08-10 18:57:12

这并不完全是您问题的答案,但由于 CF 不支持 Reflection.Emit,您可以采取的另一种序列化/反序列化方法是将您的类编译到常规 Windows 应用程序中,并利用 Reflection .Emit 以编程方式为每个类生成序列化和反序列化方法,然后可以将其合并回 CF 版本中的类中。基本上,您可以在完整的代码生成框架中使用 Reflection.Emit。

这将需要更多的工作(当然,这会是更多工作的持续来源),但它会比动态的、基于 Reflection.Emit 的方法(无论如何在 CF 中不起作用)表现得更好。当然,尽管不一定,但大多数 CF 类将在完整框架中保持不变。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文