System.Environment.OSVersion code example
Example: c# get os version
// Save the OS info to an variable
OperatingSystem os = Environment.OSVersion;
// Print the OS info to the console
Console.WriteLine($"platform: {os.Platform}\n" +
$"version: {os.Version}\n" +
$"version string: {os.VersionString}");