In a .NET 2.0 C# application I use the following code to detect the operating system platform:
string os_platform = System.Environment.OSVersion.Platform.ToS
I use a version of the following:
public static bool Is64BitSystem() { if (Directory.Exists(Environment.GetEnvironmentVariable("Program Files (x86)"))) return true; else return false; }