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.

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
Available since 1.1
Return to top
Show: