Sdílet prostřednictvím


OperatingSystem.VersionString Vlastnost

Definice

Získá zřetězené řetězcové vyjádření identifikátoru platformy, verze a aktualizace Service Pack, které jsou aktuálně nainstalovány v operačním systému.

public:
 property System::String ^ VersionString { System::String ^ get(); };
public string VersionString { get; }
member this.VersionString : string
Public ReadOnly Property VersionString As String

Hodnota vlastnosti

Řetězcové vyjádření hodnot vrácených znakem Platform, Versiona ServicePack vlastnosti.

Příklady

Následující příklad kódu ukazuje VersionString vlastnost.

// This example demonstrates the VersionString property.
using System;

class Sample
{
    public static void Main()
    {
    OperatingSystem os = Environment.OSVersion;
// Display the value of OperatingSystem.VersionString. By default, this is
// the same value as OperatingSystem.ToString.
    Console.WriteLine("This operating system is {0}", os.VersionString);
    }
}
/*
This example produces the following results:

This operating system is Microsoft Windows NT 5.1.2600.0 Service Pack 1
*/
// This example demonstrates the VersionString property.
open System

let os = Environment.OSVersion
// Display the value of OperatingSystem.VersionString. By default, this is
// the same value as OperatingSystem.ToString.
printfn $"This operating system is {os.VersionString}"
// This example produces the following results:
//    This operating system is Microsoft Windows NT 5.1.2600.0 Service Pack 1
' This example demonstrates the VersionString property.
Class Sample
   Public Shared Sub Main()
      Dim os As OperatingSystem = Environment.OSVersion

' Display the value of OperatingSystem.VersionString. By default, this is
' the same value as OperatingSystem.ToString.

      Console.WriteLine("This operating system is {0}", os.VersionString)

   End Sub
End Class
'
'This example produces the following results:
'
'This operating system is Microsoft Windows NT 5.1.2600.0 Service Pack 1

Poznámky

Ve výchozím nastavení je hodnota vrácená VersionString stejná jako hodnota vrácená metodou ToString . Implementace rozhraní .NET Framework pro jinou platformu však může vrátit vhodnější řetězec pro danou platformu.

Seznam verzí operačního systému Windows a jejich odpovídajících čísel verzí naleznete v tématu Verze operačního systému.

Platí pro

Viz také