如何检查操作系统是Linux还是不使用C# [英] how to check os is Linux Or not Using C#
本文介绍了如何检查操作系统是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 usingSystem.Environment.OSVersion.Platform
Details here: C#: How to check the OS version at runtime[^]
这很容易.
查看类System.OperatingSystem
和类型System.PlatformID
的属性System.OperatingSystem.Platform
.它具有System.PlatformID.Unix
,System.PlatformID.Win32Windows
等成员.
您可以使用类以及System.Environment
和System.Environment.OSVersion.Platform
获得系统的System.OperatingSystem
.
您可能还需要了解System.Environment.Is64BitOperatingSystem
和System.Environment.Is64BitProcess
.
就这样.
—SA
This is easy.
Look at the classSystem.OperatingSystem
and the propertySystem.OperatingSystem.Platform
of the typeSystem.PlatformID
. It has such members asSystem.PlatformID.Unix
,System.PlatformID.Win32Windows
, etc.
You can getSystem.OperatingSystem
of your system using the class andSystem.Environment
andSystem.Environment.OSVersion.Platform
.
You may also need to knowSystem.Environment.Is64BitOperatingSystem
andSystem.Environment.Is64BitProcess
.
That''s it.
—SA
这篇关于如何检查操作系统是Linux还是不使用C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文