[UWP]检测自己的是否在windows10上运行

这是在Rudy Huyn的blog上看到的, "Status" 是在win10上才出现的属性, 用来区分系统还是挺有效的。

 

public class Windows10Helper
    {
        private static bool? _isWindows10;
        public static bool IsWindows10()
        {
            if (!_isWindows10.HasValue)
            {
                _isWindows10 = Package.Current.GetType()
                                  .GetRuntimeProperty("Status") != null;
            }
            return _isWindows10.Value;
        }
    }

 

posted on 2017-02-20 15:09  利奥123  阅读(221)  评论(2)    收藏  举报