简体   繁体   中英

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"?

If yes, why can I only see "return true/false" (if you use dnSpy to refactor the code from "System")?

dnspy

If not, any differences between them? Where to use what?

In modern runtimes (net core) Is64BitProcess is defined through IntPtr.Size == 8 . See source

You see false because you're inspecting 32-bit mscorlib. 64-bit is located in C:\Windows\Microsoft.NET\Framework64\v4.0.30319 and always returns true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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