Uredi

Deli z drugimi prek


ManagementObject.GetRelated Method

Definition

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

Overloads

GetRelated()

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

GetRelated(ManagementOperationObserver)

Gets a collection of objects related to the object (associators) asynchronously. This call returns immediately, and a delegate is called when the results are available.

GetRelated(String)

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

GetRelated(ManagementOperationObserver, String)

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

GetRelated(String, String, String, String, String, String, Boolean, EnumerationOptions)

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

GetRelated(ManagementOperationObserver, String, String, String, String, String, String, Boolean, EnumerationOptions)

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

GetRelated()

Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs

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

public:
 System::Management::ManagementObjectCollection ^ GetRelated();
public System.Management.ManagementObjectCollection GetRelated ();
member this.GetRelated : unit -> System.Management.ManagementObjectCollection
Public Function GetRelated () As ManagementObjectCollection

Returns

A ManagementObjectCollection containing the related objects.

Examples

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 o.GetRelated())
            Console.WriteLine(
                "Object related to Alerter service : {0}",
                b.ClassPath);
    }
}
Imports System.Management


Class Sample_ManagementClass

    Public Overloads Shared Function Main( _
        ByVal args() As String) As Integer


        Dim o As New ManagementObject( _
        "Win32_Service=""Alerter""")

        Dim b As ManagementObject
        For Each b In o.GetRelated()
            Console.WriteLine( _
            "Object related to Alerter service : {0}", _
            b.ClassPath)
        Next b

        Return 0
    End Function

End Class

Remarks

The operation is equivalent to an ASSOCIATORS OF query where ResultClass = relatedClass.

.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.

Applies to

GetRelated(ManagementOperationObserver)

Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs

Gets a collection of objects related to the object (associators) asynchronously. This call returns immediately, and a delegate is called when the results are available.

public:
 void GetRelated(System::Management::ManagementOperationObserver ^ watcher);
public void GetRelated (System.Management.ManagementOperationObserver watcher);
member this.GetRelated : System.Management.ManagementOperationObserver -> unit
Public Sub GetRelated (watcher As ManagementOperationObserver)

Parameters

watcher
ManagementOperationObserver

The object to use to return results.

Remarks

.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.

Applies to

GetRelated(String)

Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs

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

public:
 System::Management::ManagementObjectCollection ^ GetRelated(System::String ^ relatedClass);
public System.Management.ManagementObjectCollection GetRelated (string relatedClass);
member this.GetRelated : string -> System.Management.ManagementObjectCollection
Public Function GetRelated (relatedClass As String) As ManagementObjectCollection

Parameters

relatedClass
String

A class of related objects.

Returns

A ManagementObjectCollection containing the related objects.

Examples

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
            o.GetRelated("Win32_Service"))

            Console.WriteLine(
                "Service related to the Alerter service {0} is {1}",
                b["Name"], b["State"]);
    }
}
Imports System.Management

Class Sample_ManagementClass
    Public Overloads Shared Function Main( _
        ByVal args() As String) As Integer

        Dim o As New ManagementObject( _
            "Win32_Service=""Alerter""")
        Dim b As ManagementObject
        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

        Return 0
    End Function
End Class

Remarks

.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.

Applies to

GetRelated(ManagementOperationObserver, String)

Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs

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

public:
 void GetRelated(System::Management::ManagementOperationObserver ^ watcher, System::String ^ relatedClass);
public void GetRelated (System.Management.ManagementOperationObserver watcher, string relatedClass);
member this.GetRelated : System.Management.ManagementOperationObserver * string -> unit
Public Sub GetRelated (watcher As ManagementOperationObserver, relatedClass As String)

Parameters

watcher
ManagementOperationObserver

The object to use to return results.

relatedClass
String

The class of related objects.

Remarks

This operation is equivalent to an ASSOCIATORS OF query where ResultClass = relatedClass.

.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.

Applies to

GetRelated(String, String, String, String, String, String, Boolean, EnumerationOptions)

Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs

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

public:
 System::Management::ManagementObjectCollection ^ GetRelated(System::String ^ relatedClass, System::String ^ relationshipClass, System::String ^ relationshipQualifier, System::String ^ relatedQualifier, System::String ^ relatedRole, System::String ^ thisRole, bool classDefinitionsOnly, System::Management::EnumerationOptions ^ options);
public System.Management.ManagementObjectCollection GetRelated (string relatedClass, string relationshipClass, string relationshipQualifier, string relatedQualifier, string relatedRole, string thisRole, bool classDefinitionsOnly, System.Management.EnumerationOptions options);
member this.GetRelated : string * string * string * string * string * string * bool * System.Management.EnumerationOptions -> System.Management.ManagementObjectCollection
Public Function GetRelated (relatedClass As String, relationshipClass As String, relationshipQualifier As String, relatedQualifier As String, relatedRole As String, thisRole As String, classDefinitionsOnly As Boolean, options As EnumerationOptions) As ManagementObjectCollection

Parameters

relatedClass
String

The class of the related objects.

relationshipClass
String

The relationship class of interest.

relationshipQualifier
String

The qualifier required to be present on the relationship class.

relatedQualifier
String

The qualifier required to be present on the related class.

relatedRole
String

The role that the related class is playing in the relationship.

thisRole
String

The role that this class is playing in the relationship.

classDefinitionsOnly
Boolean

When this method returns, it contains only class definitions for the instances that match the query.

options
EnumerationOptions

Extended options for how to execute the query.

Returns

A ManagementObjectCollection containing the related objects.

Remarks

This operation is equivalent to an ASSOCIATORS OF query where ResultClass = relatedClass.

.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.

Applies to

GetRelated(ManagementOperationObserver, String, String, String, String, String, String, Boolean, EnumerationOptions)

Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs
Source:
ManagementObject.cs

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

public:
 void GetRelated(System::Management::ManagementOperationObserver ^ watcher, System::String ^ relatedClass, System::String ^ relationshipClass, System::String ^ relationshipQualifier, System::String ^ relatedQualifier, System::String ^ relatedRole, System::String ^ thisRole, bool classDefinitionsOnly, System::Management::EnumerationOptions ^ options);
public void GetRelated (System.Management.ManagementOperationObserver watcher, string relatedClass, string relationshipClass, string relationshipQualifier, string relatedQualifier, string relatedRole, string thisRole, bool classDefinitionsOnly, System.Management.EnumerationOptions options);
member this.GetRelated : System.Management.ManagementOperationObserver * string * string * string * string * string * string * bool * System.Management.EnumerationOptions -> unit
Public Sub GetRelated (watcher As ManagementOperationObserver, relatedClass As String, relationshipClass As String, relationshipQualifier As String, relatedQualifier As String, relatedRole As String, thisRole As String, classDefinitionsOnly As Boolean, options As EnumerationOptions)

Parameters

watcher
ManagementOperationObserver

The object to use to return results.

relatedClass
String

The class of the related objects.

relationshipClass
String

The relationship class of interest.

relationshipQualifier
String

The qualifier required to be present on the relationship class.

relatedQualifier
String

The qualifier required to be present on the related class.

relatedRole
String

The role that the related class is playing in the relationship.

thisRole
String

The role that this class is playing in the relationship.

classDefinitionsOnly
Boolean

Return only class definitions for the instances that match the query.

options
EnumerationOptions

Extended options for how to execute the query.

Remarks

This operation is equivalent to an ASSOCIATORS OF query where ResultClass = relatedClass.

.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.

Applies to