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


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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.

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

public EnumerationOptions(
	ManagementNamedValueCollection context,
	TimeSpan timeout,
	int blockSize,
	bool rewindable,
	bool returnImmediatley,
	bool useAmendedQualifiers,
	bool ensureLocatable,
	bool prototypeOnly,
	bool directRead,
	bool enumerateDeep


Type: System.Management.ManagementNamedValueCollection

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

Type: System.TimeSpan

The time-out value for enumerating through the results.

Type: System.Int32

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

Type: System.Boolean

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

Type: System.Boolean

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

Type: System.Boolean

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

Type: System.Boolean

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

Type: System.Boolean

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

Type: System.Boolean

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

Type: System.Boolean

true to use recursive enumeration in subclasses; otherwise, false.

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.

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))

.NET Framework
Available since 1.1
Return to top