Friday, September 24, 2010

x32 Or x64? | C#

Developers more often, want to know the processor type (32 bit or 64 bit) to make some programming decisions. It usually happens, when you write applications for 64 bit machine. Registry entries are also added on different paths for 32 bit and 64 bit Applications.

When you install a 64 bit application, the entry in the registry will be made under the below path: And a 32 bit application will make an entry under the following path: The below C# code detects the processor type of the machine, where your application is running:
In the above code, PROCESSOR_ARCHITECTURE is the environment variable, which carries the information of the system type. Environment is the class (part of the System namespace) to expand the environment variable to extract the machine architecture.

No comments :

Post a Comment