ManagementQuery.ParseQuery Method (String)

 

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.

Namespace:   System.Management
Assembly:  System.Management (in System.Management.dll)

protected internal virtual void ParseQuery(
	string query
)

Parameters

query
Type: System.String

The query string to be parsed.

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.

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

    }
}

.NET Framework
Available since 1.1
Return to top
Show: