System.Runtime.OSPlatformHelper.IsMacOS C# (CSharp) Méthode

IsMacOS() public static méthode

Is current operation system Apple MacOS (OSX)
当前操作系统是否是苹果 MacOS(OSX) 操作系统
public static IsMacOS ( ) : bool
Résultat bool
        public static bool IsMacOS() => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);

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);
 }