OperatingSystemEx

Ecng.Common

Provides operating system related helper methods and properties.

Properties

IsFramework
public static bool IsFramework { get; }
value = OperatingSystemEx.IsFramework

Gets a value indicating whether the current runtime framework is .NET Framework.

Platforms
public static IEnumerable<OSPlatform> Platforms { get; }
value = OperatingSystemEx.Platforms

Gets all available operating system platforms defined in OSPlatform.

Methods

GetRuntimePackages
public static IDictionary<string, Version> GetRuntimePackages(Version fwVer)
result = OperatingSystemEx.GetRuntimePackages(fwVer)

Retrieves runtime package versions based on the provided framework version.

fwVer
The framework version to look up corresponding runtime packages.

Returns: A dictionary containing the package name as the key and its Version as the value.

IsLinux
public static bool IsLinux()
result = OperatingSystemEx.IsLinux()

Determines whether the current operating system is Linux.

Returns: true if the operating system is Linux; otherwise, false.

IsMacOS
public static bool IsMacOS()
result = OperatingSystemEx.IsMacOS()

Determines whether the current operating system is macOS.

Returns: true if the operating system is macOS; otherwise, false.

IsOSPlatform
public static bool IsOSPlatform(OSPlatform platform)
result = OperatingSystemEx.IsOSPlatform(platform)

Determines whether the specified OSPlatform is the current platform.

platform
The operating system platform to check.

Returns: true if the specified platform is the current operating system; otherwise, false.

IsWindows
public static bool IsWindows()
result = OperatingSystemEx.IsWindows()

Determines whether the current operating system is Windows.

Returns: true if the operating system is Windows; otherwise, false.