Home > .NET General > .NET 4.0 New Feature : Determine the bitness of the current process and operating system

.NET 4.0 New Feature : Determine the bitness of the current process and operating system

In .NET versions prior to .NET 4.0, in order to check wheter you were running in a 64 bit process or on a 64 bit operating system, you would have to use PInvoke calls or WMI. With the release of .NET 4.0, Microsoft has added two properties to the Environment class which will help you out; Is64BitOperatingSystem and Is64BitProcess

bool is64BitOS = Environment.Is64BitOperatingSystem;
bool is64BitProcess = Environment.Is64BitProcess;

Is64BitProcess might return false even though Is64BitOperatingSystem returns true, since the process may be a 32 bit process running on a 64 bit OS under WOW64.

Justin van Patten has a blog post about the new BCL features .NET 4.0. Read the entire blog post here.

Categories: .NET General Tags:
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.