In previous posts, “Checking If the Operating System Is macOS in C# & .NET”, “Checking If the Operating System Is Linux in C# & .NET”, and “Checking If the Operating System Is Windows in C# & .NET”, we looked at a simpler API to check whether we are running on macOS, Linux and Windows, respectively.

The APIs are largely formulaic, but there is more to explore.

Other Operating Systems

You can also check for other operating systems, including the following:

Particular Versions of Operating System

If you are interested in not just the operating system, but its versions, there are these APIs.

Platforms

You can also check whether you are running on a particular platform.

TLDR

The OperatingSystem class has various API that you can use to determine the current operating system

Happy hacking!