OSVersionHelper.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System; 6 7 namespace ManagedCommon 8 { 9 public static class OSVersionHelper 10 { 11 public static bool IsWindows10() 12 { 13 return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build < 22000; 14 } 15 16 public static bool IsWindows11() 17 { 18 return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= 22000; 19 } 20 21 public static bool IsGreaterThanWindows11_21H2() 22 { 23 return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build > 22000; 24 } 25 } 26 }