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



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JL0PD