OperatingSystem.ServicePack Property

Definition

Ruft die durch dieses OperatingSystem-Objekt dargestellte Service Pack-Version ab.Gets the service pack version represented by this OperatingSystem object.

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

Property Value

String

Die Service Pack-Version, wenn Service Packs unterstützt werden und mindestens eines installiert ist; andernfalls eine leere Zeichenfolge ("").The service pack version, if service packs are supported and at least one is installed; otherwise, an empty string ("").

Examples

Im folgenden Codebeispiel wird die ServicePack-Eigenschaft veranschaulicht.The following code example demonstrates the ServicePack property.

// 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.
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"
'

Remarks

Ein Service Pack wird zum Verteilen von Software Updates für das Betriebssystem verwendet, auf dem es installiert ist.A service pack is used to distribute software updates for the operating system on which it is installed. Allerdings verwendet nicht jedes Betriebssystem Service Packs.However, not every operating system uses service packs.

Die Service Pack Version ist, falls verfügbar, für die Anzeige bereits ordnungsgemäß formatiert.The service pack version, if available, is already correctly formatted for display.

Applies to

See also