RelatedObjectQuery.RelatedClass Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the class of the endpoint objects (the related class).

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

public string RelatedClass { get; set; }

Property Value

Type: System.String

Returns a String value containing the related class name.

Setting this property value overrides any previous value stored in the object. The query string is rebuilt to reflect the new related class.

A string containing the related class name.

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 sets a WMI class to be related to a RelatedObjectQuery.

using System; 
using System.Management;

class Sample 
    public static void Main(string[] args) 
        RelatedObjectQuery q = 
            new RelatedObjectQuery("Win32_ComputerSystem='MySystem'");
        q.RelatedClass = "Win32_Service";

.NET Framework
Available since 1.1
Return to top