[點晴永久免費OA]C#判斷操作系統類型
當前位置:點晴教程→點晴OA辦公管理信息系統
→『 經驗分享&問題答疑 』
//C#判斷操作系統是否為Windows98 public bool IsWindows98 { get { return (Environment.OSVersion.Platform == PlatformID.Win32Windows) && (Environment.OSVersion.Version.Minor == 10) && (Environment.OSVersion.Version.Revision.ToString() != "2222A"); } } //C#判斷操作系統是否為Windows98第二版 public bool IsWindows98Second { get { return (Environment.OSVersion.Platform == PlatformID.Win32Windows) && (Environment.OSVersion.Version.Minor == 10) && (Environment.OSVersion.Version.Revision.ToString() == "2222A"); } } //C#判斷操作系統是否為Windows2000 public bool IsWindows2000 { get { return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 5) && (Environment.OSVersion.Version.Minor == 0); } } //C#判斷操作系統是否為WindowsXP public bool IsWindowsXP { get { return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 5) && (Environment.OSVersion.Version.Minor == 1); } } //C#判斷操作系統是否為Windows2003 public bool IsWindows2003 { get { return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 5) && (Environment.OSVersion.Version.Minor == 2); } } //C#判斷操作系統是否為WindowsVista public bool IsWindowsVista { get { return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor == 0); } } //C#判斷操作系統是否為Windows7 public bool IsWindows7 { get { return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor == 1); } } //C#判斷操作系統是否為Unix public bool IsUnix { get { return Environment.OSVersion.Platform == PlatformID.Unix; } } 該文章在 2017/4/21 1:00:51 編輯過 |
關鍵字查詢
相關文章
正在查詢... |