# TryGetValue(TKey, out TValue)

> Returns the value associated with a key.

## Definition

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

## TryGetValue(T, T)

```csharp
public bool TryGetValue(TKey key, out TValue item)
```

### Parameters

**** (T): The key to look up.**** (T): Outputs the value associated with the key. Outputs default if the key was not present.

### Returns

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