แก้ไข

แชร์ผ่าน


ManagementQuery.ParseQuery(String) Method

Definition

Parses the query string and sets the property values accordingly. If the query is valid, the class name property and condition property of the query will be parsed.

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)

Parameters

query
String

The query string to be parsed.

Examples

The following example parses a query into class name and condition properties.

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

Remarks

.NET Framework Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

Applies to