Redigera

Dela via


EnumerationOptions.EnumerateDeep Property

Definition

Gets or sets a value indicating whether recursive enumeration is requested into all classes derived from the specified superclass. If false, only immediate derived class members are returned.

public:
 property bool EnumerateDeep { bool get(); void set(bool value); };
public bool EnumerateDeep { get; set; }
member this.EnumerateDeep : bool with get, set
Public Property EnumerateDeep As Boolean

Property Value

true if recursive enumeration is requested into all classes derived from the specified superclass; otherwise, false.

Examples

The following example initializes an EnumerationOptions variable with an EnumerationOptions constructor and then gets all the instances of a WMI class and its subclasses.

using System;
using System.Management;
public class RemoteConnect
{
    public static void Main()
    {
        EnumerationOptions opt = new EnumerationOptions();

        // Will enumerate instances of the given class
        // and any subclasses.
        opt.EnumerateDeep = true;
        ManagementClass c = new ManagementClass("CIM_Service");
        foreach (ManagementObject o in c.GetInstances(opt))
            Console.WriteLine(o["Name"]);
    }
}
Imports System.Management
Public Class RemoteConnect

    Public Overloads Shared Function Main( _
    ByVal args() As String) As Integer

        Dim opt As New EnumerationOptions

        ' Will enumerate instances of the given class
        ' and any subclasses.
        opt.EnumerateDeep = True
        Dim mngmtClass As New ManagementClass("CIM_Service")
        Dim o As ManagementObject
        For Each o In mngmtClass.GetInstances(opt)
            Console.WriteLine(o("Name"))
        Next o

        Return 0
    End Function
End Class

Remarks

Property Value

true if recursive enumeration is requested into all classes derived from the specified superclass; otherwise, false. The default value is false.

.NET Framework Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

Applies to