Skip to content

Revisit the output of Environment.OSVersion.ToString() #37831

Answered by eerhardt
am11 asked this question in General
Discussion options

You must be logged in to vote

See the very long conversation here: #26780.

IMO, the heart of this issue is "On Linux distros, what is the OS?" Is it the Linux kernel? Is it the distro?

System.OperatingSystem only has a single System.Version that it can include in its .ToString():

public override string ToString() => VersionString;
public string VersionString
{
get
{
if (_versionString == null)
{
string os;
switch (_platform)
{
case PlatformID.Win32S: os = "Microsoft Win32S "; break;
case PlatformID.Win32Windows: os = (_version.Major > 4 || (_version.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@am11
Comment options

am11 Jun 13, 2020
Collaborator Author

@eerhardt
Comment options

@am11
Comment options

am11 Jun 15, 2020
Collaborator Author

Answer selected by am11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants