共用方式為


ManagementQuery.ParseQuery(String) 方法

定義

剖析查詢字串,並相應的設定屬性值。 如果查詢有效,便會剖析查詢的類別名稱屬性及 Condition 屬性。

protected public:
 virtual void ParseQuery(System::String ^ query);
protected internal virtual void ParseQuery (string query);
abstract member ParseQuery : string -> unit
override this.ParseQuery : string -> unit
Protected Friend Overridable Sub ParseQuery (query As String)

參數

query
String

要剖析的查詢字串。

範例

下列範例會將查詢剖析為類別名稱和條件屬性。

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        SelectQuery query = new SelectQuery("SELECT * " +
            "FROM Win32_LogicalDisk " +
            "WHERE FreeSpace < 4000000");
        // The query is parsed so that the className property
        // is Win32_LogicalDisk and the condition property
        // is FreeSpace < 4000000
    }
}
Imports System.Management


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

        Dim query As SelectQuery
        query = New SelectQuery("SELECT * " & _
            "FROM Win32_LogicalDisk " & _
            "WHERE FreeSpace < 4000000")
        ' The query is parsed so that the className property
        ' is Win32_LogicalDisk and the condition property
        ' is FreeSpace < 4000000

    End Function
End Class

備註

.NET Framework 安全性

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

適用於