简体   繁体   English

“Environment.Is64BitProcess”是否等于“IntPtr.Size == 8”?

[英]Does "Environment.Is64BitProcess" equal to "IntPtr.Size == 8"?

Since "IntPtr.Size" checks the size of int's pointer based on the current process, is it the same as "Environment.Is64BitProcess"?由于“IntPtr.Size”是根据当前进程检查int指针的大小,是不是和“Environment.Is64BitProcess”一样?

If yes, why can I only see "return true/false" (if you use dnSpy to refactor the code from "System")?如果是,为什么我只能看到“返回真/假”(如果您使用 dnSpy 从“系统”重构代码)?

dnspy

If not, any differences between them?如果不是,它们之间有什么区别吗? Where to use what?在哪里使用什么?

In modern runtimes (net core) Is64BitProcess is defined through IntPtr.Size == 8 .在现代运行时(网络核心) Is64BitProcess是通过IntPtr.Size == 8定义的。 See source

You see false because you're inspecting 32-bit mscorlib.您看到false是因为您正在检查 32 位 mscorlib。 64-bit is located in C:\Windows\Microsoft.NET\Framework64\v4.0.30319 and always returns true 64 位位于C:\Windows\Microsoft.NET\Framework64\v4.0.30319并始终返回true

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

相关问题 IntPtr.Size显示操作系统版本或.NET版本? - IntPtr.Size shows OS version or .NET version? 为什么从两个不同的base64字符串转换返回相等的字节数组? - Why does conversion from two different base64 strings return equal arrays of bytes? 是否需要手动释放由DllImport返回的IntPtr指向的字符串的内存? - Does the memory of a string pointed to by an IntPtr returned by a DllImport need to be manually freed? Marshal.AllocHGlobal(0) - 为什么不返回IntPtr.Zero - Marshal.AllocHGlobal(0) - Why does this not return IntPtr.Zero IntPtr.Zero在System.Drawing.Graphics中是什么意思 - What does IntPtr.Zero mean in System.Drawing.Graphics 将 IntPtr 转换为 Int64:conv.u8 还是 conv.i8? - Convert IntPtr to Int64: conv.u8 or conv.i8? 是否可以确定IntPtr是指向32位浮点还是指向64位浮点数? - Is it possible to determine if an IntPtr is pointing to a 32-bit or to a 64-bit float? IXmlSerializable如何让我避免base64的大小膨胀? - How does IXmlSerializable let me avoid base64's size inflation? 为什么IntPtr.ToString()返回内存地址而不是字符串? - Why does IntPtr.ToString() return a memory address rather than a string? DateTime可以在64位环境中撕裂吗? - Can DateTime tear in a 64 bit environment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM