# CountValuesForKey(TKey)

> Returns the number of values associated with a given key.

## Definition

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

## CountValuesForKey(T)

```csharp
public int CountValuesForKey(TKey key)
```

### Parameters

**** (T): The key to look up.

### Returns

| Type                                                       | Description                                                                         |
| ---------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The number of values associated with the key. Returns 0 if the key was not present. |
