# Equals

> TypeIndex instances are equal if they refer to the same component type instance.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

## Equals(Object)

[TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) instances are equal if they refer to the same component type instance.

```csharp
public override bool Equals(object compare)
```

### Parameters

**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): The object to compare to this [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md).

### Returns

| Type                                                          | Description                                                                                                                                                                                                                |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the compare parameter contains a [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) object equal to this [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) instance. |

### Remarks

Note that two [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) for the same Component Type may not always be equal. For example, a type inheriting from [IComponentData](/engine/7000.0/script-reference/unity/entities/icomponentdata.md) could be used as a Chunk Component in one Archetype but not in another. If those two TypeIndices were compared they would not match even though they are for the same System.Type.

## Equals(TypeIndex)

[TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) instances are equal if they refer to the same component type instance.

```csharp
public bool Equals(TypeIndex typeIndex)
```

### Parameters

**** (\[TypeIndex]\(/engine/7000.0/script-reference/unity/entities/typeindex)): The other [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md).

### Returns

| Type                                                          | Description                                                                                                |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) instances are equal. |

### Remarks

Note that two  for the [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) same Component Type may not always be equal. For example, a type inheriting from IComponentData could be used as a Chunk Component in one Archetype but not in another. If those two TypeIndices were compared they would not match even though they are for the same System.Type.
