C#

Is64BitOperatingSystem for C# and .Net 2.0

public bool Is64BitOperatingSystem()
{
	try
	{
		string osArch = string.Empty;
		string query = String.Format("SELECT * FROM Win32_OperatingSystem");
 
		using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
		{
			foreach (ManagementObject mObject in searcher.Get())
			{
				osArch = mObject["OSArchitecture"].ToString();
				break;
			}
		}
 
		return (osArch != "64-bit") ? false : true;
	}
	catch
	{
	}
 
	return false;
}