ManagementBaseObject.GetPropertyValue(String) 메서드

정의

속성 값에 대한 동등한 접근자를 가져옵니다.

public:
 System::Object ^ GetPropertyValue(System::String ^ propertyName);
public object GetPropertyValue (string propertyName);
member this.GetPropertyValue : string -> obj
Public Function GetPropertyValue (propertyName As String) As Object

매개 변수

propertyName
String

대상 속성의 이름입니다.

반환

지정된 속성의 값입니다.

예제

다음 예제에서는 로컬 컴퓨터에서 실행 중인 프로세스의 모든 이름을 나열합니다. 코드는 메서드를 GetPropertyValue 사용하여 프로세스 이름을 가져옵니다.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        ManagementClass processClass =
            new ManagementClass("Win32_Process");

        ManagementObjectCollection classObjects;
        classObjects = processClass.GetInstances();

        foreach (ManagementObject classObject in
            classObjects)
        {
            Console.WriteLine(
                classObject.GetPropertyValue(
                "Name"));
        }
    }
}
Imports System.Management


Class Sample
    Public Overloads Shared Function _
        Main(ByVal args() As String) As Integer

        ' Get the WMI class
        Dim processClass As New ManagementClass( _
            "Win32_Process")

        Dim classObjects As ManagementObjectCollection
        classObjects = processClass.GetInstances()

        For Each classObject As ManagementObject _
            In classObjects

            Console.WriteLine( _
                classObject.GetPropertyValue( _
                    "Name"))

        Next

    End Function
End Class

설명

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

적용 대상