PropertyDataCollection.PropertyDataEnumerator Klass

Definition

Representerar uppräknaren för PropertyData objekt i PropertyDataCollection.

public: ref class PropertyDataCollection::PropertyDataEnumerator : System::Collections::IEnumerator
public class PropertyDataCollection.PropertyDataEnumerator : System.Collections.IEnumerator
type PropertyDataCollection.PropertyDataEnumerator = class
    interface IEnumerator
Public Class PropertyDataCollection.PropertyDataEnumerator
Implements IEnumerator
Arv
PropertyDataCollection.PropertyDataEnumerator
Implementeringar

Exempel

I följande exempel räknas egenskaperna för klassen Win32_LogicalDisk upp.

using System;
using System.Management;

// This sample demonstrates how to
// enumerate all properties in a
// ManagementObject using the
// PropertyDataEnumerator object.
class Sample_PropertyDataEnumerator
{
    public static int Main(string[] args)
    {
        ManagementObject disk = new
            ManagementObject("Win32_LogicalDisk.DeviceID='C:'");
        PropertyDataCollection.PropertyDataEnumerator
            propertyEnumerator = disk.Properties.GetEnumerator();
        while(propertyEnumerator.MoveNext())
        {
            PropertyData p =
                (PropertyData)propertyEnumerator.Current;
            Console.WriteLine("Property found: " + p.Name);
        }
        return 0;
    }
}
Imports System.Management

' This sample demonstrates how to
' enumerate all properties in a
' ManagementObject using
' PropertyDataEnumerator object.
Class Sample_PropertyDataEnumerator
    Public Overloads Shared Function _
        Main(ByVal args() As String) As Integer
        Dim disk As New ManagementObject( _
            "Win32_LogicalDisk.DeviceID='C:'")
        Dim propertyEnumerator As _
          PropertyDataCollection.PropertyDataEnumerator _
              = disk.Properties.GetEnumerator()
        While propertyEnumerator.MoveNext()
            Dim p As PropertyData = _
                CType(propertyEnumerator.Current, PropertyData)
            Console.WriteLine("Property found: " & p.Name)
        End While
        Return 0
    End Function
End Class

Egenskaper

Name Description
Current

Hämtar strömmen PropertyData i PropertyDataCollection uppräkningen.

Metoder

Name Description
Equals(Object)

Avgör om det angivna objektet är lika med det aktuella objektet.

(Ärvd från Object)
GetHashCode()

Fungerar som standard-hash-funktion.

(Ärvd från Object)
GetType()

Hämtar den aktuella instansen Type .

(Ärvd från Object)
MemberwiseClone()

Skapar en ytlig kopia av den aktuella Object.

(Ärvd från Object)
MoveNext()

Flyttar till nästa element i PropertyDataCollection uppräkningen.

Reset()

Återställer uppräknaren till början av PropertyDataCollection uppräkningen.

ToString()

Returnerar en sträng som representerar det aktuella objektet.

(Ärvd från Object)

Explicita gränssnittsimplementeringar

Name Description
IEnumerator.Current

Hämtar det aktuella objektet i samlingen.

Gäller för