# Contains(VisualElement)

> Checks if this element is an ancestor of the specified child element.

## Definition

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

```csharp
public bool Contains(VisualElement child)
```

### Parameters

**** (\[VisualElement]\(/engine/6000.0/script-reference/unityengine/uielements/visualelement)): The child element to test against.

### Returns

| Type                                                          | Description                                                                       |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns true if this element is a ancestor of the child element, false otherwise. |

### Remarks

This method "walks up" the hierarchy of the child element until it reaches this element or the root of the visual tree.
