Last active
April 17, 2021 06:16
-
-
Save areee/22df7ceade7e8985797dbfa7b8db31da to your computer and use it in GitHub Desktop.
A '.NET Core' way how to solve if a platform is Unix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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