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

258 views Asked by At

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?

1

There are 1 answers

0
JL0PD On BEST ANSWER

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