QualifierDataCollection.QualifierDataEnumerator 类

定义

表示 QualifierDataCollection 中的 QualifierData 对象的枚举数。Represents the enumerator for QualifierData objects in the QualifierDataCollection.

public: ref class QualifierDataCollection::QualifierDataEnumerator : System::Collections::IEnumerator
public class QualifierDataCollection.QualifierDataEnumerator : System.Collections.IEnumerator
type QualifierDataCollection.QualifierDataEnumerator = class
    interface IEnumerator
Public Class QualifierDataCollection.QualifierDataEnumerator
Implements IEnumerator
继承
QualifierDataCollection.QualifierDataEnumerator
实现

示例

下面的示例枚举Win32_LogicalDisk类中的所有限定符并显示其值。The following example enumerates through all the qualifiers in the Win32_LogicalDisk class and displays their values.

using System; 
using System.Management;
 
// This sample demonstrates how to 
// enumerate qualifiers of a ManagementClass 
// using QualifierDataEnumerator object.
class Sample_QualifierDataEnumerator 
{ 
    public static int Main(string[] args) 
    { 
        ManagementClass diskClass = 
            new ManagementClass("Win32_LogicalDisk"); 
        diskClass.Options.UseAmendedQualifiers = true; 
        QualifierDataCollection diskQualifier = 
            diskClass.Qualifiers;
        QualifierDataCollection.QualifierDataEnumerator 
            qualifierEnumerator = 
            diskQualifier.GetEnumerator();
        while(qualifierEnumerator.MoveNext()) 
        {
            Console.WriteLine(
                qualifierEnumerator.Current.Name + " = " +
                qualifierEnumerator.Current.Value);
        }
        return 0;
    }
}
Imports System.Management

' This sample demonstrates how to
' enumerate qualifiers of a ManagementClass
' using QualifierDataEnumerator object.
Class Sample_QualifierDataEnumerator
    Public Overloads Shared Function _
        Main(ByVal args() As String) As Integer
        Dim diskClass As New _
            ManagementClass("win32_logicaldisk")
        diskClass.Options.UseAmendedQualifiers = True
        Dim diskQualifier As _
            QualifierDataCollection = diskClass.Qualifiers
        Dim qualifierEnumerator As _
            QualifierDataCollection.QualifierDataEnumerator = _
                diskQualifier.GetEnumerator()
        While qualifierEnumerator.MoveNext()
            Console.WriteLine( _
                qualifierEnumerator.Current.Name & _
                " = " & qualifierEnumerator.Current.Value)
        End While
        Return 0
    End Function
End Class

属性

Current

获取或设置 QualifierDataCollection 枚举中的当前 QualifierDataGets or sets the current QualifierData in the QualifierDataCollection enumeration.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MoveNext()

移动到 QualifierDataCollection 枚举中的下一个元素。Moves to the next element in the QualifierDataCollection enumeration.

Reset()

将枚举数重置到 QualifierDataCollection 枚举的起始处。Resets the enumerator to the beginning of the QualifierDataCollection enumeration.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

IEnumerator.Current

获取集合中的当前对象。Gets the current object in the collection.

适用于