How to detect Windows 64-bit platform with .NET?

前端 未结 29 2741
野性不改
野性不改 2020-11-22 04:53

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         


        
29条回答
  •  臣服心动
    2020-11-22 05:22

    OSInfo.Bits

    using System;
    namespace CSharp411
    {
        class Program
        {
            static void Main( string[] args )
            {
               Console.WriteLine( "Operation System Information" );
               Console.WriteLine( "----------------------------" );
               Console.WriteLine( "Name = {0}", OSInfo.Name );
               Console.WriteLine( "Edition = {0}", OSInfo.Edition );
               Console.WriteLine( "Service Pack = {0}", OSInfo.ServicePack );
               Console.WriteLine( "Version = {0}", OSInfo.VersionString );
               Console.WriteLine( "Bits = {0}", OSInfo.Bits );
               Console.ReadLine();
            }
        }
    }
    

提交回复
热议问题