共用方式為


ManagementBaseObject.GetPropertyQualifierValue(String, String) 方法

定義

傳回指定屬性限定詞的值。

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

參數

propertyName
String

限定詞所屬的屬性名稱。

qualifierName
String

相關的屬性限定詞名稱。

傳回

指定限定詞的值。

範例

下列範例會GetPropertyQualifierValue使用 方法來顯示 Win32_Process 類別中每個屬性的 Description 限定符值。 如需 Win32_Process 類別的詳細資訊,請參閱 Windows Management Instrumentation 檔。

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        ManagementClass processClass =
            new ManagementClass("Win32_Process");
        processClass.Options.UseAmendedQualifiers = true;

        // Get the properties in the class
        PropertyDataCollection properties =
            processClass.Properties;

        // display the properties
        Console.WriteLine("Win32_Process Property Names: ");
        foreach (PropertyData property in properties)
        {
            Console.WriteLine(property.Name);

            foreach (QualifierData q in property.Qualifiers)
            {
                if(q.Name.Equals("Description"))
                {
                    Console.WriteLine(
                        processClass.GetPropertyQualifierValue(
                        property.Name, q.Name));
                }
            }
            Console.WriteLine();
        }
    }
}
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")
        processClass.Options.UseAmendedQualifiers = True

        ' Get the properties in the class
        Dim properties As PropertyDataCollection
        properties = processClass.Properties

        ' display the properties
        Console.WriteLine("Win32_Process Property Names: ")

        For Each p As PropertyData In properties

            Console.WriteLine(p.Name)

            For Each q As QualifierData In p.Qualifiers

                If (q.Name.Equals("Description")) Then

                    Console.WriteLine( _
                        processClass.GetPropertyQualifierValue( _
                            p.Name, q.Name))
                End If

            Next
            Console.WriteLine()

        Next
    End Function
End Class

備註

.NET Framework 安全性

完全信任立即呼叫者。 這個成員無法供部分信任的程式碼使用。 如需詳細資訊,請參閱 使用部分信任程式代碼的連結庫

適用於