The Proposal is the addition of an IsNetBSD, IsIllumos and IsSolaris methods to the OperatingSystem class.
The OperatingSystem class is already able to identify the following platforms through its IsOSPlatform method.
Platform
IsPlatform method available
BROWSER
:heavy_check_mark:
WASI
:heavy_check_mark:
WINDOWS
:heavy_check_mark:
OSX
:heavy_check_mark:
MACCATALYST
:heavy_check_mark:
IOS
:heavy_check_mark:
TVOS
:heavy_check_mark:
ANDROID
:heavy_check_mark:
LINUX
:heavy_check_mark:
FREEBSD
:heavy_check_mark:
NETBSD
:x:
ILLUMOS
:x:
SOLARIS
:x:
API Proposal
namespace System
{
public sealed class OperatingSystem : ISerializable, ICloneable
{
/// <summary>
/// Indicates whether the current application is running on NetBSD.
/// </summary>
[NonVersionable]
public static bool IsNetBSD()
/// <summary>
/// Indicates whether the current application is running on Illumos.
/// </summary>
[NonVersionable]
public static bool IsIllumos()
/// <summary>
/// Indicates whether the current application is running on Solaris.
/// </summary>
[NonVersionable]
public static bool IsSolaris()
}
}
API Usage
if (OperatingSystem.IsNetBSD())
{
Console.WriteLine("Running on NetBSD");
}
else if (OperatingSystem.IsIllumos())
{
Console.WriteLine("Running on Illumos");
}
else if (OperatingSystem.IsSolaris())
{
Console.WriteLine("Running on Solaris");
}
Alternative Designs
The proposed feature can already be accomplished with OperatingSystem.IsOSPlatform("NETBSD"), OperatingSystem.IsOSPlatform("ILLUMOS") and OperatingSystem.IsOSPlatform("SOLARIS"), but having an IsPlatform method available for each supported platform would make the overall API of the OperatingSystem class more consistent and predictable.
Background and motivation
The Proposal is the addition of an
IsNetBSD
,IsIllumos
andIsSolaris
methods to theOperatingSystem
class.The
OperatingSystem
class is already able to identify the following platforms through itsIsOSPlatform
method.API Proposal
API Usage
Alternative Designs
The proposed feature can already be accomplished with
OperatingSystem.IsOSPlatform("NETBSD")
,OperatingSystem.IsOSPlatform("ILLUMOS")
andOperatingSystem.IsOSPlatform("SOLARIS")
, but having an IsPlatform method available for each supported platform would make the overall API of theOperatingSystem
class more consistent and predictable.Risks
No response