OperatingSystem.ServicePack 속성

정의

OperatingSystem 개체가 표현하는 서비스 팩 버전을 가져옵니다.

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

속성 값

String

서비스 팩이 지원되며 서비스 팩 중 하나 이상의 설치된 경우는 서비스 팩 버전, 그렇지 않은 경우에는 빈 문자열("")입니다.

예제

다음 코드 예제는 ServicePack 속성입니다.

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

설명

서비스 팩은 설치된 운영 체제에 대한 소프트웨어 업데이트를 배포하는 데 사용됩니다. 그러나 모든 운영 체제에서 서비스 팩을 사용하는 것은 아닙니다.

서비스 팩 버전(사용 가능한 경우)이 표시할 수 있는 형식이 이미 올바르게 지정되어 있습니다.

적용 대상

추가 정보