示例代码如下:

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
    // Windows 相关逻辑
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
    // Linux 相关逻辑
}

 

  

 

posted on 2022-01-11 11:08  青叶煮酒  阅读(3703)  评论(0)    收藏  举报