简体   繁体   English

c#MemoryMappedFile in .net 3.5

[英]c# MemoryMappedFile in .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? 我需要在.net 3.5中使用MemoryMappedFile类...有没有办法找到.net 4.0中使用的类的代码并创建在.net 3.5中使用? thanks in advance 提前致谢

.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. .NET 4采用了全新的CLR,我也不会感到惊讶地发现,足够的引擎盖下发生了变化,使这个基本不可行。

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. 基本上,您应该使用支持您所需功能的.NET版本 - 您发现的任何解决方法很可能会导致难以诊断的问题,IMO。

If you need memory mapped files in .NET 3.5, you could also write your own wrapper around the respective Win32 methods from scratch. 如果您需要.NET 3.5中的内存映射文件,您还可以从头开始围绕各自的Win32方法编写自己的包装器。 This might take a bit more effort, but it avoids any licensing issues. 这可能需要更多的努力,但它避免了任何许可问题。

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. 快速查看不会显示对CLR的任何调用,但它看起来一切都是“普通”C#和一些P / Invoke到Win32。

However, note that you would have to pull quite some classes to make it possible, not only those of System.IO.MemoryMappedFiles. 但是,请注意,您必须提取一些类才能使其成为可能,而不仅仅是System.IO.MemoryMappedFiles。 And in the end you could still run into issues as described by Jon. 最后,你仍然会遇到Jon所描述的问题。

Not to speak of any licensing issues, of course. 当然,更不用说任何许可问题了。 Which would honestly be the first showstopper anyhow. 无论如何,这真的是第一个showstopper。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM