Ανάγνωση στα Αγγλικά Επεξεργασία

Κοινή χρήση μέσω


ManagementClass.GetRelationshipClasses Method

Definition

Retrieves relationship classes that relate the class to others.

Overloads

GetRelationshipClasses()

Retrieves relationship classes that relate the class to others.

GetRelationshipClasses(ManagementOperationObserver)

Retrieves relationship classes that relate the class to others, asynchronously.

GetRelationshipClasses(String)

Retrieves relationship classes that relate the class to others, where the endpoint class is the specified class.

GetRelationshipClasses(ManagementOperationObserver, String)

Retrieves relationship classes that relate the class to the specified WMI class, asynchronously.

GetRelationshipClasses(String, String, String, EnumerationOptions)

Retrieves relationship classes that relate this class to others, according to specified options.

GetRelationshipClasses(ManagementOperationObserver, String, String, String, EnumerationOptions)

Retrieves relationship classes that relate the class according to the specified options, asynchronously.

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.

GetRelationshipClasses()

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

Retrieves relationship classes that relate the class to others.

C#
public System.Management.ManagementObjectCollection GetRelationshipClasses();

Returns

A collection of association classes that relate the class to any other class.

Examples

The following example uses the GetRelationshipClasses method to list the relationship classes to the CIM_LogicalDisk class. For more information, see CIM_LogicalDisk.

C#
using System;
using System.Management;

public class Sample
{
    public static void Main()
    {
        ManagementClass c =
            new ManagementClass("CIM_LogicalDisk");

        foreach (ManagementClass r in c.GetSubclasses())
        {
            Console.WriteLine(
                "Instances of {0} are sub-classes",
                r["__CLASS"]);
        }

        foreach (ManagementClass r in c.GetRelationshipClasses())
        {
            Console.WriteLine(
                "{0} is a relationship class to " +
                c.ClassPath.ClassName,
                r["__CLASS"]);

            foreach (ManagementClass related in c.GetRelatedClasses(
                null, r.ClassPath.ClassName,
                "Association", null, null, null, null))
            {
                Console.WriteLine(
                    "{0} is related to " + c.ClassPath.ClassName,
                    related.ClassPath.ClassName);
            }
        }

        return;
    }
}

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

.NET 10 (package-provided) και άλλες εκδόσεις
Προϊόν Εκδόσεις
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

GetRelationshipClasses(ManagementOperationObserver)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

Retrieves relationship classes that relate the class to others, asynchronously.

C#
public void GetRelationshipClasses(System.Management.ManagementOperationObserver watcher);

Parameters

watcher
ManagementOperationObserver

The object to handle the asynchronous operation's progress.

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

.NET 10 (package-provided) και άλλες εκδόσεις
Προϊόν Εκδόσεις
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

GetRelationshipClasses(String)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

Retrieves relationship classes that relate the class to others, where the endpoint class is the specified class.

C#
public System.Management.ManagementObjectCollection GetRelationshipClasses(string relationshipClass);

Parameters

relationshipClass
String

The endpoint class for all relationship classes returned.

Returns

A collection of association classes that relate the class to the specified class. For more information about relationship classes, ASSOCIATORS OF Statement.

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

.NET 10 (package-provided) και άλλες εκδόσεις
Προϊόν Εκδόσεις
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

GetRelationshipClasses(ManagementOperationObserver, String)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

Retrieves relationship classes that relate the class to the specified WMI class, asynchronously.

C#
public void GetRelationshipClasses(System.Management.ManagementOperationObserver watcher, string relationshipClass);

Parameters

watcher
ManagementOperationObserver

The object to handle the asynchronous operation's progress.

relationshipClass
String

The WMI class to which all returned relationships should point.

Remarks

For more information about relationship classes, see ASSOCIATORS OF Statement.

.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

.NET 10 (package-provided) και άλλες εκδόσεις
Προϊόν Εκδόσεις
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

GetRelationshipClasses(String, String, String, EnumerationOptions)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

Retrieves relationship classes that relate this class to others, according to specified options.

C#
public System.Management.ManagementObjectCollection GetRelationshipClasses(string relationshipClass, string relationshipQualifier, string thisRole, System.Management.EnumerationOptions options);

Parameters

relationshipClass
String

All resulting relationship classes must derive from this class.

relationshipQualifier
String

Resulting relationship classes must have this qualifier.

thisRole
String

The source class must have this role in the resulting relationship classes.

options
EnumerationOptions

Specifies options for retrieving the results.

Returns

A collection of association classes that relate this class to others, according to the specified options. For more information about relationship classes, ASSOCIATORS OF Statement.

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

.NET 10 (package-provided) και άλλες εκδόσεις
Προϊόν Εκδόσεις
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

GetRelationshipClasses(ManagementOperationObserver, String, String, String, EnumerationOptions)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

Retrieves relationship classes that relate the class according to the specified options, asynchronously.

C#
public void GetRelationshipClasses(System.Management.ManagementOperationObserver watcher, string relationshipClass, string relationshipQualifier, string thisRole, System.Management.EnumerationOptions options);

Parameters

watcher
ManagementOperationObserver

The handler for progress and results of the asynchronous operation.

relationshipClass
String

The class from which all resulting relationship classes must derive.

relationshipQualifier
String

The qualifier which the resulting relationship classes must have.

thisRole
String

The role which the source class must have in the resulting relationship classes.

options
EnumerationOptions

The options for retrieving the 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

.NET 10 (package-provided) και άλλες εκδόσεις
Προϊόν Εκδόσεις
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)