# TryGetValue

> Gets the value of a property by name.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Properties](/engine/6000.5/script-reference/unity/properties.md)
* **Assembly:** UnityEngine.PropertiesModule

## TryGetValue\<T, U>(T, string, T)

Gets the value of a property by name.

```csharp
public static bool TryGetValue<TContainer, TValue>(TContainer container, string name, out TValue value)
```

### Parameters

**** (T): The container whose property value will be returned.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property to get.**** (T): When this method returns, contains the value associated with the specified name, if the property is found. otherwise the default value for the `TValue`.

### Returns

| Type                                                          | Description                                                            |
| ------------------------------------------------------------- | ---------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the value exists for the specified name; otherwise, `false`. |

## TryGetValue\<T, U>(T, string, T)

Gets the value of a property by name.

```csharp
public static bool TryGetValue<TContainer, TValue>(ref TContainer container, string name, out TValue value)
```

### Parameters

**** (T): The container whose property value will be returned.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property to get.**** (T): When this method returns, contains the value associated with the specified name, if the property is found. otherwise the default value for the `TValue`.

### Returns

| Type                                                          | Description                                                            |
| ------------------------------------------------------------- | ---------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the value exists for the specified name; otherwise, `false`. |

## TryGetValue\<T, U>(T, PropertyPath, T)

Gets the value of a property by path.

```csharp
public static bool TryGetValue<TContainer, TValue>(TContainer container, in PropertyPath path, out TValue value)
```

### Parameters

**** (T): The container whose property value will be returned.**** (\[PropertyPath]\(/engine/6000.5/script-reference/unity/properties/propertypath)): The path of the property to get.**** (T): When this method returns, contains the value associated with the specified path, if the property is found. otherwise the default value for the `TValue`.

### Returns

| Type                                                          | Description                                                           |
| ------------------------------------------------------------- | --------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the value exists at the specified path; otherwise, `false`. |

## TryGetValue\<T, U>(T, PropertyPath, T)

Gets the value of a property by path.

```csharp
public static bool TryGetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path, out TValue value)
```

### Parameters

**** (T): The container whose property value will be returned.**** (\[PropertyPath]\(/engine/6000.5/script-reference/unity/properties/propertypath)): The path of the property to get.**** (T): When this method returns, contains the value associated with the specified path, if the property is found. otherwise the default value for the `TValue`.

### Returns

| Type                                                          | Description                                                           |
| ------------------------------------------------------------- | --------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the value exists at the specified path; otherwise, `false`. |

## TryGetValue\<T, U>(T, PropertyPath, T, VisitReturnCode)

Gets the value of a property by path.

```csharp
public static bool TryGetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path, out TValue value, out VisitReturnCode returnCode)
```

### Parameters

**** (T): The container whose property value will be returned.**** (\[PropertyPath]\(/engine/6000.5/script-reference/unity/properties/propertypath)): The path of the property to get.**** (T): When this method returns, contains the value associated with the specified path, if the property is found. otherwise the default value for the `TValue`.**** (\[VisitReturnCode]\(/engine/6000.5/script-reference/unity/properties/visitreturncode)): When this method returns, contains the return code.

### Returns

| Type                                                          | Description                                                           |
| ------------------------------------------------------------- | --------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the value exists at the specified path; otherwise, `false`. |
