PropertyData.Qualifiers 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得定義在屬性上的限定詞 (Qualifier) 集。
public:
property System::Management::QualifierDataCollection ^ Qualifiers { System::Management::QualifierDataCollection ^ get(); };
public System.Management.QualifierDataCollection Qualifiers { get; }
member this.Qualifiers : System.Management.QualifierDataCollection
Public ReadOnly Property Qualifiers As QualifierDataCollection
屬性值
傳回 QualifierDataCollection,其包含定義在屬性上的限定詞集。
範例
下列範例會使用 PropertyData 類別列出Win32_OperatingSystem類別的相關信息。 如需 Win32_OperatingSystem的詳細資訊,請參閱 Windows Management Instrumentation 檔。
using System;
using System.Management;
public class Sample
{
public static void Main()
{
// Get the WMI class
ManagementClass osClass =
new ManagementClass("Win32_OperatingSystem");
osClass.Options.UseAmendedQualifiers = true;
// Get the Properties in the class
PropertyDataCollection properties =
osClass.Properties;
// display the Property names
Console.WriteLine("Property Name: ");
foreach (PropertyData property in properties)
{
Console.WriteLine(
"---------------------------------------");
Console.WriteLine(property.Name);
Console.WriteLine("Description: " +
property.Qualifiers["Description"].Value);
Console.WriteLine();
Console.WriteLine("Type: ");
Console.WriteLine(property.Type);
Console.WriteLine();
Console.WriteLine("Qualifiers: ");
foreach(QualifierData q in
property.Qualifiers)
{
Console.WriteLine(q.Name);
}
Console.WriteLine();
foreach (ManagementObject c in osClass.GetInstances())
{
Console.WriteLine("Value: ");
Console.WriteLine(
c.Properties[property.Name.ToString()].Value);
Console.WriteLine();
}
}
}
}
Imports System.Management
Public Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
Dim osClass As ManagementClass = _
New ManagementClass("Win32_OperatingSystem")
osClass.Options.UseAmendedQualifiers = True
' Get the Properties in the class
Dim properties As PropertyDataCollection = _
osClass.Properties
' display the Property names
Console.WriteLine("Property Name: ")
For Each p As PropertyData In properties
Console.WriteLine( _
"---------------------------------------")
Console.WriteLine(p.Name)
Console.WriteLine("Description: " & _
p.Qualifiers("Description").Value)
Console.WriteLine()
Console.WriteLine("Type: ")
Console.WriteLine(p.Type)
Console.WriteLine()
Console.WriteLine("Qualifiers: ")
For Each q As QualifierData In _
p.Qualifiers
Console.WriteLine(q.Name)
Next
Console.WriteLine()
For Each c As ManagementObject In osClass.GetInstances()
Console.WriteLine("Value: ")
Console.WriteLine( _
c.Properties(p.Name.ToString()).Value)
Console.WriteLine()
Next
Next
End Function
End Class
備註
屬性值
, QualifierDataCollection 表示 屬性上定義的限定符集合。
.NET Framework 安全性
完全信任立即呼叫者。 這個成員無法供部分信任的程式碼使用。 如需詳細資訊,請參閱 使用部分信任程式代碼的連結庫。