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 判断操作系统
最新推荐文章于 2022-06-24 10:28:58 发布