# CompareTo(EntityId)

> Compares this EntityId to another EntityId.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public int CompareTo(EntityId other)
```

### Parameters

**** (\[EntityId]\(/engine/6000.6/script-reference/unityengine/entityid)): The EntityId to compare against.

### Returns

| Type                                                       | Description                                                                                                                        |
| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A negative value if this EntityId is less than the other, zero if they are equal, or a positive value if this EntityId is greater. |

### Remarks

The ordering of `EntityId` values is arbitrary and does not reflect creation order or any other meaningful property. Do not rely on the comparison result for anything other than establishing a consistent ordering for data structures that require it (such as sorted collections).
