# Contains

> Returns true if a particular value is present in this container.

## Definition

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

## Contains\<T, U>(NativeArray\<T>, T)

Returns true if a particular value is present in this container.

```csharp
public static bool Contains<T, U>(this NativeArray<T> container, U value) where T : unmanaged, IEquatable<U>
```

### Parameters

**** (\[NativeArray\<T>]\(/engine/6000.7/script-reference/unity/collections/nativearray1)): The container to search.**** (T): The value to locate.

### Returns

| Type                                                          | Description                                     |
| ------------------------------------------------------------- | ----------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the value is present in this container. |

## Contains\<T, U>(ReadOnly, T)

Returns true if a particular value is present in this container.

```csharp
public static bool Contains<T, U>(this NativeArray<T>.ReadOnly container, U value) where T : unmanaged, IEquatable<U>
```

### Parameters

**** (\[ReadOnly]\(/engine/6000.7/script-reference/unity/collections/nativearray1/readonly)): The container to search.**** (T): The value to locate.

### Returns

| Type                                                          | Description                                     |
| ------------------------------------------------------------- | ----------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the value is present in this container. |

## Contains\<T, U>(NativeList\<T>, T)

Returns true if a particular value is present in this container.

```csharp
public static bool Contains<T, U>(this NativeList<T> container, U value) where T : unmanaged, IEquatable<U>
```

### Parameters

**** (\[NativeList\<T>]\(/engine/6000.7/script-reference/unity/collections/nativelist1)): The container to search.**** (T): The value to locate.

### Returns

| Type                                                          | Description                                     |
| ------------------------------------------------------------- | ----------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the value is present in this container. |

## Contains\<T, U>(\`\<>\*, int, T)

Returns true if a particular value is present in a buffer.

```csharp
public static bool Contains<T, U>(T* ptr, int length, U value) where T : unmanaged, IEquatable<U>
```

### Parameters

**** (\[\<T>\*]\(./)): The buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of elements in the buffer.**** (T): The value to locate.

### Returns

| Type                                                          | Description                                 |
| ------------------------------------------------------------- | ------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the value is present in the buffer. |

## Contains\<T, U>(ReadOnlySpan\<T>, T)

Returns true if a particular value is present in this container.

```csharp
public static bool Contains<T, U>(this ReadOnlySpan<T> roSpan, U value) where T : unmanaged, IEquatable<U>
```

### Parameters

**** (\[ReadOnlySpan\<T>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): A ReadOnlySpan.**** (T): The value to locate.

### Returns

| Type                                                          | Description                                     |
| ------------------------------------------------------------- | ----------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the value is present in this container. |
