Share via


RelatedObjectQuery.RelatedClass 屬性

定義

取得或設定端點物件的類別 (相關類別)。

public:
 property System::String ^ RelatedClass { System::String ^ get(); void set(System::String ^ value); };
public string RelatedClass { get; set; }
member this.RelatedClass : string with get, set
Public Property RelatedClass As String

屬性值

傳回包含相關類別名稱的 String 值。

範例

下列範例會設定與相關的 RelatedObjectQueryWMI 類別。

using System;
using System.Management;

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


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

        Dim q As New RelatedObjectQuery( _
            "Win32_ComputerSystem=""MySystem""")
        q.RelatedClass = "Win32_Service"

    End Function
End Class

備註

設定這個屬性值會覆寫儲存在 物件中的任何先前值。 系統會重建查詢字串,以反映新的相關類別。

屬性值

包含相關類別名稱的字串。

.NET Framework 安全性

完全信任立即呼叫者。 這個成員無法供部分信任的程式碼使用。 如需詳細資訊,請參閱 使用部分信任程式代碼的連結庫

適用於