This documentation is archived and is not being maintained.

ManagementObject.GetRelated Method (String)

.NET Framework 1.1

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

[Visual Basic]
Overloads Public Function GetRelated( _
   ByVal relatedClass As String _
) As ManagementObjectCollection
[C#]
public ManagementObjectCollection GetRelated(
 string relatedClass
);
[C++]
public: ManagementObjectCollection* GetRelated(
 String* relatedClass
);
[JScript]
public function GetRelated(
   relatedClass : String
) : ManagementObjectCollection;

Parameters

relatedClass
A class of related objects.

Return Value

A ManagementObjectCollection containing the related objects.

Example

[C#] 
ManagementObject o = new ManagementObject("Win32_Service='Alerter'");
foreach (ManagementBaseObject b in o.GetRelated("Win32_Service")
    Console.WriteLine("Service related to the Alerter service {0} is {1}", b["Name"], b["State"]);
   
[Visual Basic] 
Dim o As New ManagementObject("Win32_Service=""Alerter""");
Dim b As ManagementBaseObject
For Each b in o.GetRelated("Win32_Service")
    Console.WriteLine("Service related to the Alerter service {0} is {1}", b("Name"), b("State"))
Next b
   

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ManagementObject Class | ManagementObject Members | System.Management Namespace | ManagementObject.GetRelated Overload List

Show: