EnumerationOptions Constructors

Definition

Initializes a new instance of the EnumerationOptions class.

Overloads

EnumerationOptions()

Initializes a new instance of the EnumerationOptions class with default values (see the individual property descriptions for what the default values are). This is the parameterless constructor.

EnumerationOptions(ManagementNamedValueCollection, TimeSpan, Int32, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)

Initializes a new instance of the EnumerationOptions class to be used for queries or enumerations, allowing the user to specify values for the different options.

EnumerationOptions()

Source:
ManagementOptions.cs
Source:
ManagementOptions.cs
Source:
ManagementOptions.cs
Source:
ManagementOptions.cs

Initializes a new instance of the EnumerationOptions class with default values (see the individual property descriptions for what the default values are). This is the parameterless constructor.

public:
 EnumerationOptions();
public EnumerationOptions ();
Public Sub New ()

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

.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

EnumerationOptions(ManagementNamedValueCollection, TimeSpan, Int32, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)

Source:
ManagementOptions.cs
Source:
ManagementOptions.cs
Source:
ManagementOptions.cs
Source:
ManagementOptions.cs

Initializes a new instance of the EnumerationOptions class to be used for queries or enumerations, allowing the user to specify values for the different options.

public:
 EnumerationOptions(System::Management::ManagementNamedValueCollection ^ context, TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep);
public EnumerationOptions (System.Management.ManagementNamedValueCollection context, TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep);
new System.Management.EnumerationOptions : System.Management.ManagementNamedValueCollection * TimeSpan * int * bool * bool * bool * bool * bool * bool * bool -> System.Management.EnumerationOptions
Public Sub New (context As ManagementNamedValueCollection, timeout As TimeSpan, blockSize As Integer, rewindable As Boolean, returnImmediatley As Boolean, useAmendedQualifiers As Boolean, ensureLocatable As Boolean, prototypeOnly As Boolean, directRead As Boolean, enumerateDeep As Boolean)

Parameters

context
ManagementNamedValueCollection

The options context object containing provider-specific information that can be passed through to the provider.

timeout
TimeSpan

The time-out value for enumerating through the results.

blockSize
Int32

The number of items to retrieve at one time from WMI.

rewindable
Boolean

true to show that the result set is rewindable (allows multiple traversal); otherwise, false.

returnImmediatley
Boolean

true to show that the operation should return immediately (semi-sync) or block until all results are available; otherwise, false.

useAmendedQualifiers
Boolean

true to show that the returned objects should contain amended (locale-aware) qualifiers; otherwise, false.

ensureLocatable
Boolean

true to ensure all returned objects have valid paths; otherwise, false.

prototypeOnly
Boolean

true to return a prototype of the result set instead of the actual results; otherwise, false.

directRead
Boolean

true to retrieve objects of only the specified class or from derived classes as well; otherwise, false.

enumerateDeep
Boolean

true to use recursive enumeration in subclasses; 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(
            null, System.TimeSpan.MaxValue,
            1, true, true, false,
            true, false, false, 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 EnumerationOptions
        Opt = New EnumerationOptions( _
            Nothing, System.TimeSpan.MaxValue, _
            1, True, True, False, _
            True, False, False, 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

.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