# Q

> Convenience overload, shorthand for Query(). Build(). First()

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.0/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## Q\<T>(VisualElement, string, string\[])

Convenience overload, shorthand for [Query()](/engine/6000.0/script-reference/unityengine/uielements/uqueryextensions/query.md).[Build()](/engine/6000.0/script-reference/unityengine/uielements/uquerybuilder1/build.md).[First()](/engine/6000.0/script-reference/unityengine/uielements/uquerybuilder1/first.md)

```csharp
public static T Q<T>(this VisualElement e, string name = null, params string[] classes) where T : VisualElement
```

### Parameters

**** (\[VisualElement]\(/engine/6000.0/script-reference/unityengine/uielements/visualelement)): Root VisualElement on which the selector will be applied.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If specified, will select elements with this name.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): If provided, it selects elements with the specified class (case sensitive, to be distinguished from Type).

### Returns

| Type | Description                                                             |
| ---- | ----------------------------------------------------------------------- |
| T    | The first element matching all the criteria, or null if none was found. |

## Q(VisualElement, string, string\[])

Convenience overload, shorthand for [Query()](/engine/6000.0/script-reference/unityengine/uielements/uqueryextensions/query.md).[Build()](/engine/6000.0/script-reference/unityengine/uielements/uquerybuilder1/build.md).[First()](/engine/6000.0/script-reference/unityengine/uielements/uquerybuilder1/first.md)

```csharp
public static VisualElement Q(this VisualElement e, string name = null, params string[] classes)
```

### Parameters

**** (\[VisualElement]\(/engine/6000.0/script-reference/unityengine/uielements/visualelement)): Root VisualElement on which the selector will be applied.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If specified, will select elements with this name.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): If provided, it selects elements with the specified class (case sensitive, to be distinguished from Type).

### Returns

| Type                                                                                     | Description                                                             |
| ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [VisualElement](/engine/6000.0/script-reference/unityengine/uielements/visualelement.md) | The first element matching all the criteria, or null if none was found. |

## Q\<T>(VisualElement, string, string)

Convenience overload, shorthand for [Query()](/engine/6000.0/script-reference/unityengine/uielements/uqueryextensions/query.md).[Build()](/engine/6000.0/script-reference/unityengine/uielements/uquerybuilder1/build.md).[First()](/engine/6000.0/script-reference/unityengine/uielements/uquerybuilder1/first.md)

```csharp
public static T Q<T>(this VisualElement e, string name = null, string className = null) where T : VisualElement
```

### Parameters

**** (\[VisualElement]\(/engine/6000.0/script-reference/unityengine/uielements/visualelement)): Root VisualElement on which the selector will be applied.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If specified, will select elements with this name.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If provided, it selects elements with the specified class (case sensitive, to be distinguished from Type).

### Returns

| Type | Description                                                             |
| ---- | ----------------------------------------------------------------------- |
| T    | The first element matching all the criteria, or null if none was found. |

## Q(VisualElement, string, string)

Convenience overload, shorthand for `Query<T>.Build().First().`

```csharp
public static VisualElement Q(this VisualElement e, string name = null, string className = null)
```

### Parameters

**** (\[VisualElement]\(/engine/6000.0/script-reference/unityengine/uielements/visualelement)): Root VisualElement on which the selector will be applied.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If specified, will select elements with this name.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If provided, it selects elements with the specified class (case sensitive, to be distinguished from Type).

### Returns

| Type                                                                                     | Description                                                             |
| ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [VisualElement](/engine/6000.0/script-reference/unityengine/uielements/visualelement.md) | The first element matching all the criteria, or null if none was found. |
