This documentation is archived and is not being maintained.

SelectQuery Constructor

.NET Framework 1.1

Initializes a new instance of the SelectQuery class.

Overload List

Initializes a new instance of the SelectQuery class. This is the default constructor.

[Visual Basic] Public Sub New()
[C#] public SelectQuery();
[C++] public: SelectQuery();
[JScript] public function SelectQuery();

Initializes a new instance of the SelectQuery class for the specified query or the specified class name.

[Visual Basic] Public Sub New(String)
[C#] public SelectQuery(string);
[C++] public: SelectQuery(String*);
[JScript] public function SelectQuery(String);

Initializes a new instance of the SelectQuery class for a schema query, optionally specifying a condition. For schema queries, only the condition parameter is valid: className and selectedProperties are not supported and are ignored.

[Visual Basic] Public Sub New(Boolean, String)
[C#] public SelectQuery(bool, string);
[C++] public: SelectQuery(bool, String*);
[JScript] public function SelectQuery(Boolean, String);

Initializes a new instance of the SelectQuery class with the specified class name and condition.

[Visual Basic] Public Sub New(String, String)
[C#] public SelectQuery(string, string);
[C++] public: SelectQuery(String*, String*);
[JScript] public function SelectQuery(String, String);

Initializes a new instance of the SelectQuery class with the specified class name and condition, selecting only the specified properties.

[Visual Basic] Public Sub New(String, String, String())
[C#] public SelectQuery(string, string, string[]);
[C++] public: SelectQuery(String*, String*, String*[]);
[JScript] public function SelectQuery(String, String, String[]);

Example

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of the SelectQuery constructor. For other examples that might be available, see the individual overload topics.
[C#] 
String[] properties = {"VariableName", "VariableValue"};

SelectQuery s = new SelectQuery("Win32_Environment",
                                "User='<system>'", 
                                properties);
   
[Visual Basic] 
Dim properties As String[] = {"VariableName", "VariableValue"}

Dim s As New SelectQuery("Win32_Environment", _
                         "User=""<system>""", _
                         properties)
   

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

SelectQuery Class | SelectQuery Members | System.Management Namespace

Show: