ManagementQuery.ParseQuery(String) 方法

定义

分析查询字符串并相应地设置属性值。 如果查询有效,将分析查询的类名属性和条件属性。

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 安全性

对直接调用方的完全信任。 此成员不能由部分信任的代码使用。 有关详细信息,请参阅 使用部分受信任的代码中的库

适用于