MethodData.Qualifiers 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取在方法中定义的限定符集合。 每个元素都是 QualifierData 类型,并包含诸如限定符名称、值和风格之类的信息。
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,它包含方法的限定符。
示例
以下示例使用 类列出有关 Win32_Process.Create 方法MethodData的信息。 有关 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 methods in the class
MethodDataCollection methods =
processClass.Methods;
// display the method names
Console.WriteLine("Method Name: ");
foreach (MethodData method in methods)
{
if(method.Name.Equals("Create"))
{
Console.WriteLine(method.Name);
Console.WriteLine("Description: " +
method.Qualifiers["Description"].Value);
Console.WriteLine();
Console.WriteLine("In-parameters: ");
foreach(PropertyData i in
method.InParameters.Properties)
{
Console.WriteLine(i.Name);
}
Console.WriteLine();
Console.WriteLine("Out-parameters: ");
foreach(PropertyData o in
method.OutParameters.Properties)
{
Console.WriteLine(o.Name);
}
Console.WriteLine();
Console.WriteLine("Qualifiers: ");
foreach(QualifierData q in
method.Qualifiers)
{
Console.WriteLine(q.Name);
}
Console.WriteLine();
}
}
}
}
Imports System.Management
Public Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
Dim processClass As ManagementClass = _
New ManagementClass("Win32_Process")
processClass.Options.UseAmendedQualifiers = True
' Get the methods in the class
Dim methods As MethodDataCollection = _
processClass.Methods
' display the method names
Console.WriteLine("Method Name: ")
For Each method As MethodData In methods
If (method.Name.Equals("Create")) Then
Console.WriteLine(method.Name)
Console.WriteLine("Description: " & _
method.Qualifiers("Description").Value)
Console.WriteLine()
Console.WriteLine("In-parameters: ")
For Each i As PropertyData In _
method.InParameters.Properties
Console.WriteLine(i.Name)
Next
Console.WriteLine()
Console.WriteLine("Out-parameters: ")
For Each o As PropertyData In _
method.OutParameters.Properties
Console.WriteLine(o.Name)
Next
Console.WriteLine()
Console.WriteLine("Qualifiers: ")
For Each q As QualifierData In _
method.Qualifiers
Console.WriteLine(q.Name)
Next
Console.WriteLine()
End If
Next
End Function 'Main
End Class
注解
属性值
包含 QualifierDataCollection 此方法的限定符的 。
.NET Framework 安全性
对直接调用方的完全信任。 此成员不能由部分信任的代码使用。 有关详细信息,请参阅 使用部分受信任的代码中的库。