ManagementObject.GetRelated Method (String)


Gets a collection of objects related to the object (associators).

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

public ManagementObjectCollection GetRelated(
	string relatedClass


Type: System.String

A class of related objects.

Return Value

Type: System.Management.ManagementObjectCollection

A ManagementObjectCollection containing the related objects.

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 calls the GetRelated method to get a collection of objects related to an instance of the ManagementObject class.

using System;
using System.Management;

public class Sample
    public static void Main(string[] args) 
        ManagementObject o = 
            new ManagementObject("Win32_Service='Alerter'");

        foreach (ManagementObject b in

                "Service related to the Alerter service {0} is {1}",
                b["Name"], b["State"]);

.NET Framework
Available since 1.1
Return to top