Click here to Skip to main content
15,905,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

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

Thanks
Posted

One can detect the execution platform using System.Environment.OSVersion.Platform

Details here: C#: How to check the OS version at runtime[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 26-Apr-11 0:49am    
This is the answer, my 5.
For all and extra info without a link, see my answer.
--SA
Sandeep Mewara 26-Apr-11 1:25am    
Thanks
anvas kuttan 26-Apr-11 1:07am    
perfect my 5 ..
Sandeep Mewara 26-Apr-11 1:25am    
Thanks.
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
 
Share this answer
 
v3
Comments
Sandeep Mewara 26-Apr-11 1:25am    
Great... good to know.
Sergey Alexandrovich Kryukov 26-Apr-11 1:27am    
Thank you, Sandeep.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900