OperatingSystem.ServicePack Właściwość

Definicja

Pobiera wersję dodatku Service Pack reprezentowaną przez ten OperatingSystem obiekt.

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

Wartość właściwości

Wersja dodatku Service Pack, jeśli są obsługiwane dodatki Service Pack i co najmniej jedna z nich jest zainstalowana; w przeciwnym razie pusty ciąg ("").

Przykłady

Poniższy przykład kodu przedstawia ServicePack właściwość .

// This example demonstrates the OperatingSystem.ServicePack property.
using namespace System;
int main()
{
   OperatingSystem^ os = Environment::OSVersion;
   String^ sp = os->ServicePack;
   Console::WriteLine( "Service pack version = \"{0}\"", sp );
}

/*
This example produces the following results:

Service pack version = "Service Pack 1"

*/
// This example demonstrates the OperatingSystem.ServicePack property.
using System;

class Sample
{
    public static void Main()
    {
    OperatingSystem os = Environment.OSVersion;
    String sp = os.ServicePack;
    Console.WriteLine("Service pack version = \"{0}\"", sp);
    }
}
/*
This example produces the following results:

Service pack version = "Service Pack 1"

*/
// This example demonstrates the OperatingSystem.ServicePack property.
open System

let os = Environment.OSVersion
let sp = os.ServicePack
printfn $"Service pack version = \"{sp}\""
// This example produces the following results:
//     Service pack version = "Service Pack 1"
' This example demonstrates the OperatingSystem.ServicePack property.
Class Sample
   Public Shared Sub Main()
      Dim os As OperatingSystem = Environment.OSVersion
      Console.WriteLine("Service pack version = ""{0}""", os.ServicePack)
   End Sub
End Class
'
'This example produces the following results:
'
'Service pack version = "Service Pack 1"
'

Uwagi

Dodatek Service Pack służy do dystrybucji aktualizacji oprogramowania dla systemu operacyjnego, na którym jest zainstalowany. Jednak nie każdy system operacyjny używa dodatków Service Pack.

Wersja dodatku Service Pack, jeśli jest dostępna, jest już poprawnie sformatowana do wyświetlania.

Dotyczy

Zobacz też