如何检查操作系统是Linux还是不使用C# [英] how to check os is Linux Or not Using C#

查看:504
本文介绍了如何检查操作系统是Linux还是不使用C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何使用C#检查操作系统是否为Linux



how to check Operating system is Linux Or not Using C#

Thanks

推荐答案

可以使用System.Environment.OSVersion.Platform
检测执行平台
此处的详细信息:
One can detect the execution platform using System.Environment.OSVersion.Platform

Details here: C#: How to check the OS version at runtime[^]


这很容易.

查看类System.OperatingSystem和类型System.PlatformID的属性System.OperatingSystem.Platform.它具有System.PlatformID.UnixSystem.PlatformID.Win32Windows等成员.

您可以使用类以及System.EnvironmentSystem.Environment.OSVersion.Platform获得系统的System.OperatingSystem.

您可能还需要了解System.Environment.Is64BitOperatingSystemSystem.Environment.Is64BitProcess.

就这样.

—SA
This is easy.

Look at the class System.OperatingSystem and the property System.OperatingSystem.Platform of the type System.PlatformID. It has such members as System.PlatformID.Unix, System.PlatformID.Win32Windows, etc.

You can get System.OperatingSystem of your system using the class and System.Environment and System.Environment.OSVersion.Platform.

You may also need to know System.Environment.Is64BitOperatingSystem and System.Environment.Is64BitProcess.

That''s it.

—SA


这篇关于如何检查操作系统是Linux还是不使用C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆