# CompareTo

> Returns the lexicographical sort order of this string relative to another.

## Definition

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

## CompareTo(string)

Returns the lexicographical sort order of this string relative to another.

```csharp
[ExcludeFromBurstCompatTesting("Takes managed string")]
public int CompareTo(string other)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): A `System.String` to compare with.

### Returns

| Type                                                       | Description                                                                              |
| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | An integer denoting the lexicographical sort order of this string relative to the other: |

## CompareTo(FixedString32Bytes)

Returns the lexicographical sort order of this string relative to another.

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

### Parameters

**** (\[FixedString32Bytes]\(/engine/6000.7/script-reference/unity/collections/fixedstring32bytes)): A string to compare with.

### Returns

| Type                                                       | Description                                                                            |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A number denoting the lexicographical sort order of this string relative to the other: |

## CompareTo(FixedString64Bytes)

Returns the lexicographical sort order of this string relative to another.

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

### Parameters

**** (\[FixedString64Bytes]\(/engine/6000.7/script-reference/unity/collections/fixedstring64bytes)): A string to compare with.

### Returns

| Type                                                       | Description                                                                            |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A number denoting the lexicographical sort order of this string relative to the other: |

## CompareTo(FixedString128Bytes)

Returns the lexicographical sort order of this string relative to another.

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

### Parameters

**** (\[FixedString128Bytes]\(/engine/6000.7/script-reference/unity/collections/fixedstring128bytes)): A string to compare with.

### Returns

| Type                                                       | Description                                                                            |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A number denoting the lexicographical sort order of this string relative to the other: |

## CompareTo(FixedString512Bytes)

Returns the lexicographical sort order of this string relative to another.

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

### Parameters

**** (\[FixedString512Bytes]\(/engine/6000.7/script-reference/unity/collections/fixedstring512bytes)): A string to compare with.

### Returns

| Type                                                       | Description                                                                            |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A number denoting the lexicographical sort order of this string relative to the other: |

## CompareTo(FixedString4096Bytes)

Returns the lexicographical sort order of this string relative to another.

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

### Parameters

**** (\[FixedString4096Bytes]\(/engine/6000.7/script-reference/unity/collections/fixedstring4096bytes)): A string to compare with.

### Returns

| Type                                                       | Description                                                                            |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A number denoting the lexicographical sort order of this string relative to the other: |
