PropertyDataCollection.PropertyDataEnumerator Třída
Definice
Představuje enumerátor pro PropertyData objekty v PropertyDataCollection .Represents the enumerator for PropertyData objects in the 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
- Dědičnost
-
PropertyDataCollection.PropertyDataEnumerator
- Implementuje
Příklady
Následující příklad vytvoří výčet prostřednictvím vlastností třídy Win32_LogicalDisk .The following example enumerates through the properties of the Win32_LogicalDisk class.
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
Vlastnosti
Current |
Získá aktuální PropertyData ve PropertyDataCollection výčtu.Gets the current PropertyData in the PropertyDataCollection enumeration. |
Metody
Equals(Object) |
Určí, zda se zadaný objekt rovná aktuálnímu objektu.Determines whether the specified object is equal to the current object. (Zděděno od Object) |
GetHashCode() |
Slouží jako výchozí funkce hash.Serves as the default hash function. (Zděděno od Object) |
GetType() |
Získá Type aktuální instanci.Gets the Type of the current instance. (Zděděno od Object) |
MemberwiseClone() |
Vytvoří kopii aktuálního seznamu Object .Creates a shallow copy of the current Object. (Zděděno od Object) |
MoveNext() |
Přesune se k dalšímu prvku ve PropertyDataCollection výčtu.Moves to the next element in the PropertyDataCollection enumeration. |
Reset() |
Obnoví enumerátor na začátek PropertyDataCollection výčtu.Resets the enumerator to the beginning of the PropertyDataCollection enumeration. |
ToString() |
Vrátí řetězec, který představuje aktuální objekt.Returns a string that represents the current object. (Zděděno od Object) |
Explicitní implementace rozhraní
IEnumerator.Current |
Získá aktuální objekt v kolekci.Gets the current object in the collection. |