I'm retrieving the operating system platform with .NET Core with [system.runtime.interopservices][1]<br><br>I have created the code below and was wondering if there was a way that I could use a switch statement rather than the if statement for determining which platform is in use. /// <summary> /// Operating System Class /// For Retrieving The OS /// Platform. /// AE : 9/08/2018 /// </summary> class OperatingSystem { /// <summary> /// Operating System Platforms. /// </summary> public enum OSPlatform { Windows, OSX, Linux, Not_Supported } /// <summary> /// Return Operating System /// </summary> public static OSPlatform GetPlatform { // Switch Statement Not Compatitable get { if (RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows)) { return OSPlatform.Windows; } else if (RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX)) { return OSPlatform.OSX; } else if (RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux)) { return OSPlatform.Linux; } else { return OSPlatform.Not_Supported; } } } } The class is being called like this, static void Main() { switch (OperatingSystem.GetPlatform) { case OperatingSystem.OSPlatform.Windows: Console.WriteLine("Goto Windows Class"); break; case OperatingSystem.OSPlatform.OSX: Console.WriteLine("Goto OSX Class"); break; case OperatingSystem.OSPlatform.Linux: Console.WriteLine("Goto Linux Class"); break; default: Console.WriteLine("OS Not Supported"); break; } Console.ReadKey(); } [1]: https://www.nuget.org/packages/System.Runtime.InteropServices/