# ColliderArray2D

> A collection of Collider2D.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.Physics2DModule
* **Implements:** [IEnumerable\<Collider2D>](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1), [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.ienumerable), [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public struct ColliderArray2D : IEnumerable<Collider2D>, IEnumerable, IDisposable
```

## Remarks

The collection of [Collider2D](/engine/6000.6/script-reference/unityengine/collider2d.md) can be enumerated using "foreach" or its contents accessed via an indexer. The collection does not allocate any managed memory but must be disposed of.

This collection can only be created by Unity and is typically returned as results from physics queries.

## Properties

| Property                                                                        | Description                                                                                                                  |
| ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [this\[\]](/engine/6000.6/script-reference/unityengine/colliderarray2d/item.md) | An indexer allowing access to any [Collider2D](/engine/6000.6/script-reference/unityengine/collider2d.md) in the collection. |
| [Length](/engine/6000.6/script-reference/unityengine/colliderarray2d/length.md) | The number of [Collider2D](/engine/6000.6/script-reference/unityengine/collider2d.md) elements in the collection.            |

## Methods

| Method                                                                                        | Description                                                                                                  |
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| [Dispose](/engine/6000.6/script-reference/unityengine/colliderarray2d/dispose.md)             | Disposes of the native memory allocated by the collection.                                                   |
| [GetEnumerator](/engine/6000.6/script-reference/unityengine/colliderarray2d/getenumerator.md) | Gets an enumerator which allows iteration of the collection. This is typically used implicitly by "foreach". |
