Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ManagementClass.GetSubclasses Method (EnumerationOptions)

Retrieves the subclasses of the class using the specified options.

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

public ManagementObjectCollection GetSubclasses(
	EnumerationOptions options
)

Parameters

options
Type: System.Management.EnumerationOptions

The specified additional options for retrieving subclasses of the class.

Return Value

Type: System.Management.ManagementObjectCollection
A collection of the ManagementObject objects representing the subclasses of the WMI class, according to the specified options.

.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 shows how to initialize a ManagementClass variable with a ManagementClass constructor and then receive the subclasses of the WMI class passed into the constructor.

using System;
using System.Management;

public class Example
{
    public static void Main() 
    {
        EnumerationOptions opt = new EnumerationOptions();   
        // Causes return of deep subclasses 
        // as opposed to only immediate ones.
        opt.EnumerateDeep = true;  
        ManagementObjectCollection subclasses = (new
            ManagementClass("CIM_LogicalDisk")).GetSubclasses(opt);
        foreach(ManagementClass subclass in subclasses)
        {
            Console.WriteLine( "Subclass found: {0}" ,
                subclass["__CLASS"]);
        }

        return;
    }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft