Thursday, January 19, 2012

Detecting 64-bit OS in Microsoft.Net 4.0

If you have ever worked with a version of the Microsoft.Net Framework prior to v. 4.0, you probably have been frustrated by the lack of a native Microsoft.Net API to detect whether or not the underlying Operating System (OS) is a 32-bit OS or a 64-bit OS.

Well, now with Microsoft.Net 4.0, you finally have that capability!

You simply reference Environment.Is64BitOperatingSystem in your code!

In addition, they have also added the option for Environment.Is64BitProcess if you have a need to detect whether the running process is a 32-bit or 64-bit process (such as when running in IIS 7/7.5 when the Application Pool settings dictate whether or not you are running in a 32-bit or native 64-bit process).

You can read more about the Environment class here: 

No comments:

Post a Comment