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

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

## ConvertFromSurrogate(ReadOnlyDictionarySurrogate&lt;TKey, TValue&gt;) {#convertfromsurrogate-ref-orleans-serialization-codecs-readonlydictionarysurrogat-7e188c9f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.readonlydictionarycodec-2/methods/convertfromsurrogate-ref-orleans-serialization-codecs-readonlydictionarysurrogat-7e188c9f/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/ReadOnlyDictionaryCodec.cs#L17)

```csharp
public override ReadOnlyDictionary<TKey, TValue> ReadOnlyDictionaryCodec<TKey, ConvertFromSurrogate(ref ReadOnlyDictionarySurrogate<TKey, TValue> surrogate)
```

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

### Parameters

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

### Returns

The value.

## ConvertToSurrogate(ReadOnlyDictionary&lt;TKey, TValue&gt;, ReadOnlyDictionarySurrogate&lt;TKey, TValue&gt;) {#converttosurrogate-system-collections-objectmodel-readonlydictionary-tkey-tvalue-98e8f8b9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.readonlydictionarycodec-2/methods/converttosurrogate-system-collections-objectmodel-readonlydictionary-tkey-tvalue-98e8f8b9/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/ReadOnlyDictionaryCodec.cs#L19)

```csharp
public override void ReadOnlyDictionaryCodec<TKey, ConvertToSurrogate(ReadOnlyDictionary<TKey, TValue> value, ref ReadOnlyDictionarySurrogate<TKey, TValue> surrogate)
```

Converts a value to the surrogate type.

### Parameters

- `value` (`ReadOnlyDictionary<TKey, TValue>`): The value.
- `surrogate` (`ReadOnlyDictionarySurrogate<TKey, TValue>`): The surrogate.
