# TryRemoveItem(int, bool)

> Removes an item by id.

## Definition

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

```csharp
public abstract bool TryRemoveItem(int id, bool rebuildTree = true)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The item id.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to refresh the tree data. Set to `false` when doing multiple operations and call [BaseVerticalCollectionView.RefreshItems()](/engine/6000.7/script-reference/unityengine/uielements/baseverticalcollectionview/refreshitems.md).

### Returns

| Type                                                          | Description                                          |
| ------------------------------------------------------------- | ---------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Whether the item was successfully found and removed. |
