2019-10-18-C#-判断系统版本

title author date CreateTime categories
C# 判断系统版本
lindexi
2019-10-18 15:2:0 +0800
2018-03-08 17:34:38 +0800
C#

本文告诉大家如何判断系统是 win7 还是 xp 系统

使用下面代码可以判断

        private static readonly Version _osVersion = Environment.OSVersion.Version;
 
        internal static bool IsOSVistaOrNewer
        {
            get { return _osVersion >= new Version(6, 0); }
        }
 
        internal static bool IsOSWindows7OrNewer
        {
            get { return _osVersion >= new Version(6, 1); }
        }
 
        internal static bool IsOSWindows8OrNewer
        {
            get { return _osVersion >= new Version(6, 2); }
        }

上面方法不能判断是win10系统

关于C#中Environment.OSVersion判断系统及Win10上的问题 - 夏至千秋 - 博客园

原文地址:https://www.cnblogs.com/lindexi/p/12086563.html