Skip to content

Instantly share code, notes, and snippets.

@areee
Last active April 17, 2021 06:16
Show Gist options
  • Save areee/22df7ceade7e8985797dbfa7b8db31da to your computer and use it in GitHub Desktop.
Save areee/22df7ceade7e8985797dbfa7b8db31da to your computer and use it in GitHub Desktop.
A '.NET Core' way how to solve if a platform is Unix
using System;
namespace Sandbox
{
class MainClass
{
public static void Main(string[] args)
{
var platform = Environment.OSVersion.Platform;
if (platform.Equals(PlatformID.Unix))
{
Console.WriteLine("It's Unix operating system (like macOS)!");
}
else
{
Console.WriteLine("It's something else, e.g. Windows...");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment