RelationshipQuery 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 RelationshipQuery 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| RelationshipQuery() |
初始化 RelationshipQuery 類別的新執行個體。 這就是無參數建構子。 |
| RelationshipQuery(String) |
初始化 RelationshipQuery 類別的新執行個體。 若指定的字串能成功解析為 WQL 查詢,則視為查詢字串;否則,則假設它是查詢的來源物件路徑。 此時,查詢假設為實例查詢。 |
| RelationshipQuery(String, String) |
初始化該類別的新實例 RelationshipQuery ,針對給定的原始物件與關聯類別。 查詢假設為實例查詢(而非結構查詢)。 |
| RelationshipQuery(Boolean, String, String, String, String) |
使用給定的參數集初始化該類別的新實例 RelationshipQuery ,用於結構查詢。 此建構子僅用於結構查詢,因此第一個參數必須為真。 |
| RelationshipQuery(String, String, String, String, Boolean) |
初始化該類別的新實例 RelationshipQuery ,針對給定的參數集合。 查詢假設為實例查詢(而非結構查詢)。 |
RelationshipQuery()
初始化 RelationshipQuery 類別的新執行個體。 這就是無參數建構子。
public:
RelationshipQuery();
public RelationshipQuery();
Public Sub New ()
備註
.NET Framework 安全性
完全信任當下的來電者。 此成員無法被部分受信任的程式碼使用。 欲了解更多資訊,請參閱 「部分受信任程式碼的函式庫使用」。
適用於
RelationshipQuery(String)
初始化 RelationshipQuery 類別的新執行個體。 若指定的字串能成功解析為 WQL 查詢,則視為查詢字串;否則,則假設它是查詢的來源物件路徑。 此時,查詢假設為實例查詢。
public:
RelationshipQuery(System::String ^ queryOrSourceObject);
public RelationshipQuery(string queryOrSourceObject);
new System.Management.RelationshipQuery : string -> System.Management.RelationshipQuery
Public Sub New (queryOrSourceObject As String)
參數
- queryOrSourceObject
- String
查詢字串或這個查詢的類別名稱。
範例
以下範例說明 WMI 類別與 RelatedObjectQuery之間的關係類型。
using System;
using System.Management;
class Sample
{
public static void Main(string[] args)
{
// Full query string is specified
// to the constructor
RelationshipQuery q =
new RelationshipQuery(
"references of {Win32_ComputerSystem.Name='mymachine'}");
// Only the object of interest is
// specified to the constructor
RelationshipQuery query =
new RelationshipQuery("Win32_Service.Name='Alerter'");
}
}
Imports System.Management
Public Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Full query string is specified
' to the constructor
Dim q As New RelationshipQuery( _
"references of {Win32_ComputerSystem.Name='mymachine'}")
' Only the object of interest is
' specified to the constructor
Dim query As New RelationshipQuery( _
"Win32_Service.Name='Alerter'")
End Function
End Class
備註
.NET Framework 安全性
完全信任當下的來電者。 此成員無法被部分受信任的程式碼使用。 欲了解更多資訊,請參閱 「部分受信任程式碼的函式庫使用」。
適用於
RelationshipQuery(String, String)
初始化該類別的新實例 RelationshipQuery ,針對給定的原始物件與關聯類別。 查詢假設為實例查詢(而非結構查詢)。
public:
RelationshipQuery(System::String ^ sourceObject, System::String ^ relationshipClass);
public RelationshipQuery(string sourceObject, string relationshipClass);
new System.Management.RelationshipQuery : string * string -> System.Management.RelationshipQuery
Public Sub New (sourceObject As String, relationshipClass As String)
參數
- sourceObject
- String
此查詢的來源物件路徑。
- relationshipClass
- String
查詢的關係類型。
備註
.NET Framework 安全性
完全信任當下的來電者。 此成員無法被部分受信任的程式碼使用。 欲了解更多資訊,請參閱 「部分受信任程式碼的函式庫使用」。
適用於
RelationshipQuery(Boolean, String, String, String, String)
使用給定的參數集初始化該類別的新實例 RelationshipQuery ,用於結構查詢。 此建構子僅用於結構查詢,因此第一個參數必須為真。
public:
RelationshipQuery(bool isSchemaQuery, System::String ^ sourceObject, System::String ^ relationshipClass, System::String ^ relationshipQualifier, System::String ^ thisRole);
public RelationshipQuery(bool isSchemaQuery, string sourceObject, string relationshipClass, string relationshipQualifier, string thisRole);
new System.Management.RelationshipQuery : bool * string * string * string * string -> System.Management.RelationshipQuery
Public Sub New (isSchemaQuery As Boolean, sourceObject As String, relationshipClass As String, relationshipQualifier As String, thisRole As String)
參數
- isSchemaQuery
- Boolean
true用以表示這是一個結構查詢;否則,。 false
- sourceObject
- String
此查詢的原始類別路徑。
- relationshipClass
- String
查詢的關係類型。
- relationshipQualifier
- String
這是關係類別中必須具備的資格條件。
- thisRole
- String
來源類別在關係中必須扮演的角色。
備註
.NET Framework 安全性
完全信任當下的來電者。 此成員無法被部分受信任的程式碼使用。 欲了解更多資訊,請參閱 「部分受信任程式碼的函式庫使用」。
適用於
RelationshipQuery(String, String, String, String, Boolean)
初始化該類別的新實例 RelationshipQuery ,針對給定的參數集合。 查詢假設為實例查詢(而非結構查詢)。
public:
RelationshipQuery(System::String ^ sourceObject, System::String ^ relationshipClass, System::String ^ relationshipQualifier, System::String ^ thisRole, bool classDefinitionsOnly);
public RelationshipQuery(string sourceObject, string relationshipClass, string relationshipQualifier, string thisRole, bool classDefinitionsOnly);
new System.Management.RelationshipQuery : string * string * string * string * bool -> System.Management.RelationshipQuery
Public Sub New (sourceObject As String, relationshipClass As String, relationshipQualifier As String, thisRole As String, classDefinitionsOnly As Boolean)
參數
- sourceObject
- String
此查詢的來源物件路徑。
- relationshipClass
- String
查詢的關係類型。
- relationshipQualifier
- String
關係物件上必須有限定詞。
- thisRole
- String
來源物件在關係中所扮演的角色。
- classDefinitionsOnly
- Boolean
當此方法回傳時,包含一個布林值,表示只會回傳所得物件的類別定義。
備註
.NET Framework 安全性
完全信任當下的來電者。 此成員無法被部分受信任的程式碼使用。 欲了解更多資訊,請參閱 「部分受信任程式碼的函式庫使用」。