次の方法で共有


RelationshipQuery コンストラクタ (String)

RelationshipQuery クラスの新しいインスタンスを初期化します。指定した文字列を WQL クエリとして正しく解析できる場合は、クエリ文字列と見なされます。解析できない場合は、クエリのソース オブジェクトのパスと見なされます。この場合、クエリはインスタンス クエリと見なされます。

名前空間: System.Management
アセンブリ: System.Management (system.management.dll 内)

構文

'宣言
Public Sub New ( _
    queryOrSourceObject As String _
)
'使用
Dim queryOrSourceObject As String

Dim instance As New RelationshipQuery(queryOrSourceObject)
public RelationshipQuery (
    string queryOrSourceObject
)
public:
RelationshipQuery (
    String^ queryOrSourceObject
)
public RelationshipQuery (
    String queryOrSourceObject
)
public function RelationshipQuery (
    queryOrSourceObject : String
)

パラメータ

  • queryOrSourceObject
    このクエリのクエリ文字列またはクラス名。

使用例

WMI クラスと RelatedObjectQuery の間のリレーションシップの種類を設定する例を次に示します。

Imports System
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
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'");
    }
}

.NET Framework のセキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「」を参照してください。

プラットフォーム

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

RelationshipQuery クラス
RelationshipQuery メンバ
System.Management 名前空間