OperatingSystem.ServicePack Propiedad

Definición

Obtiene la versión del Service Pack representada por este objeto OperatingSystem.

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

Valor de propiedad

Versión del Service Pack, si el sistema operativo admite Service Packs y, al menos, está instalado uno; de lo contrario, una cadena vacía ("").

Ejemplos

En el ejemplo de código siguiente se muestra la ServicePack propiedad .

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

Comentarios

Un Service Pack se usa para distribuir las actualizaciones de software para el sistema operativo en el que está instalado. Sin embargo, no todos los sistemas operativos usan Service Packs.

La versión del Service Pack, si está disponible, ya tiene el formato correcto para mostrarse.

Se aplica a

Consulte también