System.Runtime.OSPlatformHelper.IsWindows C# (CSharp) Method

IsWindows() public static method

Is current operation system Microsoft Windows
当前操作系统是否为微软视窗(Windows)操作系统
public static IsWindows ( ) : bool
return bool
        public static bool IsWindows() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

Usage Example

 /// <summary>
 /// Get current operation system platform information<br />
 /// 获取当前操作系统平台信息(<see cref="OSPlatform"/>)
 /// </summary>
 /// <returns></returns>
 // ReSharper disable once InconsistentNaming
 public virtual OSPlatform GetCurrentOSPlatform()
 {
     if (OSPlatformHelper.IsMacOS())
     {
         return(OSPlatform.OSX);
     }
     if (OSPlatformHelper.IsWindows())
     {
         return(OSPlatform.Windows);
     }
     return(OSPlatform.Linux);
 }