# Sandbox.Metadata.GetValueOrDefault

```csharp
T GetValueOrDefault(string key, T defaultValue = null)
```

Get the a value. If it's missing or the wrong type then use the default value.

### Parameters

- `key` (`string`)
- `defaultValue` (`T`), default `null`

### Returns

`T`

Declared in [Sandbox.Metadata](/api/Sandbox.Metadata).
Assembly: `Sandbox.Engine`.
