OSPlatform.Create(String) Method

Definition

Creates a new OSPlatform instance.

C#
public static System.Runtime.InteropServices.OSPlatform Create(string osPlatform);

Parameters

osPlatform
String

The name of the platform that this instance represents.

Returns

An object that represents the osPlatform operating system.

Exceptions

osPlatform is an empty string.

osPlatform is null.

Remarks

Calling the Create method with the following strings is equivalent to retrieving the OSPlatform object from the corresponding static property:

osPlatform string OSPlatform property
"FREEBSD" OSPlatform.FreeBSD
"LINUX" OSPlatform.Linux
"OSX" OSPlatform.OSX
"WINDOWS" OSPlatform.Windows

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1