# Compare(T, T)

> Compares two values.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

```csharp
public int Compare(T x, T y)
```

### Parameters

**** (T): First value to compare.**** (T): Second value to compare.

### Returns

| Type                                                       | Description                                                                                                                         |
| ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A signed integer that denotes the relative values of `x` and `y`: 0 if they're equal, negative if `x < y`, and positive if `x > y`. |
