diff --git a/snippets/fsharp/System/PlatformID/Overview/fs.fsproj b/snippets/fsharp/System/PlatformID/Overview/fs.fsproj new file mode 100644 index 00000000000..5ead19347af --- /dev/null +++ b/snippets/fsharp/System/PlatformID/Overview/fs.fsproj @@ -0,0 +1,10 @@ + + + Exe + net6.0 + + + + + + \ No newline at end of file diff --git a/snippets/fsharp/System/PlatformID/Overview/pid.fs b/snippets/fsharp/System/PlatformID/Overview/pid.fs new file mode 100644 index 00000000000..270d6f28704 --- /dev/null +++ b/snippets/fsharp/System/PlatformID/Overview/pid.fs @@ -0,0 +1,24 @@ +// +// This example demonstrates the PlatformID enumeration. +open System + +let msg1 = "This is a Windows operating system." +let msg2 = "This is a Unix operating system." +let msg3 = "ERROR: This platform identifier is invalid." + +// Assume this example is run on a Windows operating system. +let os = Environment.OSVersion +let pid = os.Platform +match pid with +| PlatformID.Win32NT +| PlatformID.Win32S +| PlatformID.Win32Windows +| PlatformID.WinCE -> + printfn $"{msg1}" +| PlatformID.Unix -> + printfn $"{msg2}" +| _ -> + printfn $"{msg3}" +// This example produces the following results: +// This is a Windows operating system. +// \ No newline at end of file diff --git a/xml/System/PlatformID.xml b/xml/System/PlatformID.xml index 386dba8c8c6..7cda5bb01c6 100644 --- a/xml/System/PlatformID.xml +++ b/xml/System/PlatformID.xml @@ -66,6 +66,7 @@ :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/PlatformID/Overview/pid.cs" id="Snippet1"::: + :::code language="fsharp" source="~/snippets/fsharp/System/PlatformID/Overview/pid.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/platformID.class/VB/pid.vb" id="Snippet1"::: ]]>