Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

PropertyDataCollection.PropertyDataEnumerator Class

Represents the enumerator for PropertyData objects in the PropertyDataCollection.

For a list of all members of this type, see PropertyDataCollection.PropertyDataEnumerator Members.

System.Object
   System.Management.PropertyDataCollection.PropertyDataEnumerator

[Visual Basic]
Public Class PropertyDataCollection.PropertyDataEnumerator
   Implements IEnumerator
[C#]
public class PropertyDataCollection.PropertyDataEnumerator :
   IEnumerator
[C++]
public __gc class PropertyDataCollection.PropertyDataEnumerator :
   public IEnumerator
[JScript]
public class PropertyDataCollection.PropertyDataEnumerator
   implements IEnumerator

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Example

[C#] 
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;
    }
}
   
[Visual Basic] 
Imports System
Imports System.Management

' This sample demonstrates how to enumerate all properties in a
' ManagementObject using PropertyDataEnumerator object.
Class Sample_PropertyDataEnumerator
    Overloads Public Shared Function Main(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
   

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Management

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Management (in System.Management.dll)

See Also

PropertyDataCollection.PropertyDataEnumerator Members | System.Management Namespace

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.