# IDehydrationContext.TryAddValue(string, T?)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.idehydrationcontext/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.idehydrationcontext/methods/)

```csharp
public abstract bool TryAddValue<T>(string key, T? value)
```

Attempts to a value to the dehydration context, associated with the provided key, serializing it using [Serializer](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.serializer/). If a serializer is found for the value, and the key has not already been added, then the value is added and the method returns `true`. If no serializer exists or the key has already been added, then the value is not added and the method returns `false`.

### Parameters

- `key` (`string`): The key.
- `value` (`T?`): The value to add.
