C # How to get the operating system architecture (x86 or x64)?

Possible duplicate:
How to detect 64-bit Windows platform with .net?

How to get the architecture of the operating system (x86 or x64) using .NET 2.0?

I did not find a good method for getting the OS architecture on Google. I found how to determine if a process is 32-bit or 64-bit.

If you can't find anything in .NET 2.0, please tell me. :)

+4
source share
1 answer

Unacceptable answer in duplicate question, but here is how I do it:

Use GetEnvironmentVariable to search for the variable PROCESSOR_ARCHITEW6432. If it does not exist, you should run 32bit:

 bool is64bit = !string.IsNullOrEmpty( Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")); 
+10
source

All Articles