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

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

## ConvertFromSurrogate(SortedDictionarySurrogate&lt;TKey, TValue&gt;) {#convertfromsurrogate-ref-orleans-serialization-codecs-sorteddictionarysurrogate-87c9f65a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.sorteddictionarycodec-2/methods/convertfromsurrogate-ref-orleans-serialization-codecs-sorteddictionarysurrogate-87c9f65a/)

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

```csharp
public override SortedDictionary<TKey, TValue> SortedDictionaryCodec<TKey, ConvertFromSurrogate(ref SortedDictionarySurrogate<TKey, TValue> surrogate)
```

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

### Parameters

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

### Returns

The value.

## ConvertToSurrogate(SortedDictionary&lt;TKey, TValue&gt;, SortedDictionarySurrogate&lt;TKey, TValue&gt;) {#converttosurrogate-system-collections-generic-sorteddictionary-tkey-tvalue-ref-o-282a0efc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.sorteddictionarycodec-2/methods/converttosurrogate-system-collections-generic-sorteddictionary-tkey-tvalue-ref-o-282a0efc/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/SortedDictionaryCodec.cs#L40-L42)

```csharp
public override void SortedDictionaryCodec<TKey, ConvertToSurrogate(SortedDictionary<TKey, TValue> value, ref SortedDictionarySurrogate<TKey, TValue> surrogate)
```

Converts a value to the surrogate type.

### Parameters

- `value` (`SortedDictionary<TKey, TValue>`): The value.
- `surrogate` (`SortedDictionarySurrogate<TKey, TValue>`): The surrogate.
