What’s new in C# 4.0: Part 2: Windows 64-bit Support
Saturday, 10 July 2010 at 9:10 am AEST | Trackback
The Microsoft .NET framework 4 includes support for identifying whether the application is running in a 64-bit process or on a 64-bit operating system.
You are able to check if you are running in a 64-bit process, by using Environment.Is64BitProcess, which returns a boolean of true if you are in a 64-bit process, or false if you are not.
You can check if the operating system in 64-bit by using Environment.Is64BitOperatingSystem, which also returns a boolean of true if you are on a 64-bit operating system, or false if you are not.
Another welcome addition is support to specify either a 64-bit or 32-bit version of the Windows Registry. You can specify either view using the Microsoft.Win32.RegistryView enumeration. For example, to open the 64-bit view of the Current User hive:
RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64); |
If you specify 64-bit view on a 32-bit operating system, the 32-bit view will be returned.
