Bagikan melalui


OperatingSystem.ServicePack Properti

Definisi

Mendapatkan versi paket layanan yang diwakili oleh objek ini OperatingSystem .

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

Nilai Properti

Versi paket layanan, jika paket layanan didukung dan setidaknya satu diinstal; jika tidak, string kosong ("").

Contoh

Contoh kode berikut menunjukkan ServicePack properti .

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

Keterangan

Paket layanan digunakan untuk mendistribusikan pembaruan perangkat lunak untuk sistem operasi tempat paket tersebut diinstal. Namun, tidak setiap sistem operasi menggunakan paket layanan.

Versi paket layanan, jika tersedia, sudah diformat dengan benar untuk ditampilkan.

Berlaku untuk

Lihat juga