using System; namespace MAX.Core.Helpers; /// /// 常用公共操作 /// public static partial class Common { /// /// 获取类型 /// /// 类型 public static Type GetType() { return GetType(typeof(T)); } /// /// 获取类型 /// /// 类型 public static Type GetType(Type type) { return Nullable.GetUnderlyingType(type) ?? type; } /// /// 换行符 /// public static string Line => Environment.NewLine; #if NET5_0 /// /// 是否Linux操作系统 /// public static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux); /// /// 是否Windows操作系统 /// public static bool IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); /// /// 是否苹果操作系统 /// public static bool IsOsx => RuntimeInformation.IsOSPlatform(OSPlatform.OSX); /// /// 当前操作系统 /// public static string System => IsWindows ? "Windows" : IsLinux ? "Linux" : IsOsx ? "OSX" : string.Empty; #endif }