This question already has an answer here:
Is there anyway I can find out if my .NET process is running as 32bit process or 64bit process?
You probably want Environment.Is64BitProcess if you're using .NET 4.0 or later. Otherwise, check IntPtr.Size
, as suggested in the other answers.
if (IntPtr.Size == 4)
// 32-bit
else if (IntPtr.Size == 8)
// 64-bit
However, as pointed by @Jim Mischel, on .NET 4 and above, you should use
Use IntPtr.Size property to find out process bitness.
if(IntPtr.Size == 4)
// 32 bit process
else
// 64bit process
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.