# ImmutableDictionaryCodec&lt;TKey, TValue&gt; Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.immutabledictionarycodec-2/)

## ConvertFromSurrogate(ImmutableDictionarySurrogate&lt;TKey, TValue&gt;) {#convertfromsurrogate-ref-orleans-serialization-codecs-immutabledictionarysurroga-9ed694ad}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.immutabledictionarycodec-2/methods/convertfromsurrogate-ref-orleans-serialization-codecs-immutabledictionarysurroga-9ed694ad/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/ImmutableDictionaryCodec.cs#L28-L31)

```csharp
public override ImmutableDictionary<TKey, TValue> ImmutableDictionaryCodec<TKey, ConvertFromSurrogate(ref ImmutableDictionarySurrogate<TKey, TValue> surrogate)
```

Converts a value from the surrogate type to the field type.

### Parameters

- `surrogate` (`ImmutableDictionarySurrogate<TKey, TValue>`): The surrogate.

### Returns

The value.

## ConvertToSurrogate(ImmutableDictionary&lt;TKey, TValue&gt;, ImmutableDictionarySurrogate&lt;TKey, TValue&gt;) {#converttosurrogate-system-collections-immutable-immutabledictionary-tkey-tvalue-475a4fcf}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.immutabledictionarycodec-2/methods/converttosurrogate-system-collections-immutable-immutabledictionary-tkey-tvalue-475a4fcf/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/ImmutableDictionaryCodec.cs#L36-L38)

```csharp
public override void ImmutableDictionaryCodec<TKey, ConvertToSurrogate(ImmutableDictionary<TKey, TValue> value, ref ImmutableDictionarySurrogate<TKey, TValue> surrogate)
```

Converts a value to the surrogate type.

### Parameters

- `value` (`ImmutableDictionary<TKey, TValue>`): The value.
- `surrogate` (`ImmutableDictionarySurrogate<TKey, TValue>`): The surrogate.
