Share via


RelatedObjectQuery.RelationshipClass 屬性

定義

取得或設定關聯性 (關聯) 的型別。

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

屬性值

傳回 String 值,包含關聯性類別名稱。

範例

下列範例會設定 WMI 類別與 RelatedObjectQuery之間的關聯性類型。

using System;
using System.Management;

class Sample
{
    public static void Main(string[] args)
    {
        RelatedObjectQuery q =
            new RelatedObjectQuery("Win32_Service='TCP/IP'");
        q.RelationshipClass = "Win32_DependentService";
    }
}
Imports System.Management


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

        Dim q As New RelatedObjectQuery( _
            "Win32_Service=""TCP/IP""")
        q.RelationshipClass = "Win32_DependentService"

    End Function
End Class

備註

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

屬性值

包含關聯性類別名稱的字串。

.NET Framework 安全性

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

適用於