OperatingSystem.ServicePack Egenskap

Definition

Hämtar service pack-versionen som representeras av det här OperatingSystem objektet.

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

Egenskapsvärde

Service Pack-versionen, om Service Pack stöds och minst en är installerad. annars en tom sträng ("").

Exempel

Följande kodexempel visar egenskapen ServicePack .

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

Kommentarer

Ett Service Pack används för att distribuera programuppdateringar för det operativsystem där det är installerat. Men inte alla operativsystem använder service pack.

Service Pack-versionen, om den är tillgänglig, är redan korrekt formaterad för visning.

Gäller för

Se även