.net 3.5 中的 c# MemoryMappedFile

发布于 2024-11-28 01:01:38 字数 95 浏览 4 评论 0原文

我需要在 .net 3.5 中使用 MemoryMappedFile 类... 有没有办法找到 .net 4.0 中使用的类的代码并创建在 .net 3.5 中使用? 提前致谢

I need to use MemoryMappedFile class in .net 3.5...
is there any way to find the code of the classes used in .net 4.0 and create to use in .net 3.5?
thanks in advance

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

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

发布评论

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

评论(3

静若繁花 2024-12-05 01:01:38

如果您需要 .NET 3.5 中的内存映射文件,您还可以围绕 各个 Win32 方法 从头开始​​。这可能需要更多的努力,但它可以避免任何许可问题。

If you need memory mapped files in .NET 3.5, you could also write your own wrapper around the respective Win32 methods from scratch. This might take a bit more effort, but it avoids any licensing issues.

玩世 2024-12-05 01:01:38

.NET 4 使用全新的 CLR,如果发现底层发生了足够多的变化,使得这基本上不可行,我一点也不感到惊讶。

基本上,您应该努力使用支持您所需功能的 .NET 版本 - IMO,您发现的任何解决方法都很可能导致难以诊断的问题。

.NET 4 uses a whole new CLR, and I wouldn't be at all surprised to find that enough had changed under the hood to make this basically infeasible.

Basically, you should be working to use a version of .NET that supports the functionality you need - any workaround you find is very likely to cause hard-to-diagnose issues, IMO.

世俗缘 2024-12-05 01:01:38

可以使用反编译器或共享源代码(故意省略链接)来获取代码。快速查看并没有发现任何对 CLR 的调用,但看起来一切都是“普通”C# 和一些对 Win32 的 P/Invoke。

但是,请注意,您必须拉取相当多的类才能使其成为可能,而不仅仅是 System.IO.MemoryMappedFiles 的类。最终您仍然可能会遇到乔恩所描述的问题。

当然,更不用说任何许可问题。老实说,无论如何,这将是第一个令人震惊的事情。

You could use a decompiler or the shared source (links omitted on purpose) to get the code. A quick look doesn't reveal any calls into the CLR, but it looks everything is "plain" C# and some P/Invoke to Win32.

However, note that you would have to pull quite some classes to make it possible, not only those of System.IO.MemoryMappedFiles. And in the end you could still run into issues as described by Jon.

Not to speak of any licensing issues, of course. Which would honestly be the first showstopper anyhow.

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