using System; using System.Runtime.InteropServices; //从 NuGet 引入 namespace Core.Test { class Program { static void Main(string[] args) { Console.WriteLine("判断是否为Windows Linux OSX"); Console.WriteLine($"Linux:{RuntimeInformation.IsOSPlatform(OSPlatform.Linux)}"); Console.WriteLine($"OSX:{RuntimeInformation.IsOSPlatform(OSPlatform.OSX)}"); Console.WriteLine($"Windows:{RuntimeInformation.IsOSPlatform(OSPlatform.Windows)}"); Console.Read(); } } }
.net core 判断操作系统
猜你喜欢
转载自blog.csdn.net/yenange/article/details/80533146
今日推荐
周排行