Class OperatingSystemEx
Provides operating system related helper methods and properties.
public static class OperatingSystemEx
- Inheritance
-
OperatingSystemEx
- Inherited Members
Properties
IsFramework
Gets a value indicating whether the current runtime framework is .NET Framework.
public static bool IsFramework { get; }
Property Value
Platforms
Gets all available operating system platforms defined in OSPlatform.
public static IEnumerable<OSPlatform> Platforms { get; }
Property Value
Methods
GetRuntimePackages(Version)
Retrieves runtime package versions based on the provided framework version.
public static IDictionary<string, Version> GetRuntimePackages(Version fwVer)
Parameters
fwVer
VersionThe framework version to look up corresponding runtime packages.
Returns
- IDictionary<string, Version>
A dictionary containing the package name as the key and its Version as the value.
Exceptions
- ArgumentNullException
Thrown when
fwVer
is null.
IsLinux()
Determines whether the current operating system is Linux.
public static bool IsLinux()
Returns
- bool
true
if the operating system is Linux; otherwise,false
.
IsMacOS()
Determines whether the current operating system is macOS.
public static bool IsMacOS()
Returns
- bool
true
if the operating system is macOS; otherwise,false
.
IsOSPlatform(OSPlatform)
Determines whether the specified OSPlatform is the current platform.
public static bool IsOSPlatform(this OSPlatform platform)
Parameters
platform
OSPlatformThe operating system platform to check.
Returns
- bool
true
if the specified platform is the current operating system; otherwise,false
.
IsWindows()
Determines whether the current operating system is Windows.
public static bool IsWindows()
Returns
- bool
true
if the operating system is Windows; otherwise,false
.