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

EnumerationOptions Constructor (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.

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
)

Parameters

context
Type: System.Management.ManagementNamedValueCollection
The options context object containing provider-specific information that can be passed through to the provider.
timeout
Type: System.TimeSpan
The time-out value for enumerating through the results.
blockSize
Type: System.Int32
The number of items to retrieve at one time from WMI.
rewindable
Type: System.Boolean
true to show that the result set is rewindable (allows multiple traversal); otherwise, false.
returnImmediatley
Type: System.Boolean
true to show that the operation should return immediately (semi-sync) or block until all results are available; otherwise, false.
useAmendedQualifiers
Type: System.Boolean
true to show that the returned objects should contain amended (locale-aware) qualifiers; otherwise, false.
ensureLocatable
Type: System.Boolean
true to ensure all returned objects have valid paths; otherwise, false.
prototypeOnly
Type: System.Boolean
true to return a prototype of the result set instead of the actual results; otherwise, false.
directRead
Type: System.Boolean
true to retrieve objects of only the specified class or from derived classes as well; otherwise, false.
enumerateDeep
Type: System.Boolean
true to use recursive enumeration in subclasses; otherwise, 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.

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"]);
    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2016 Microsoft