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

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

## ReadValue(Reader&lt;TInput&gt;, Field) {#readvalue-1-ref-orleans-serialization-buffers-reader-tinput-orleans-serializatio-d814a209}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.dictionarycodec-2/methods/readvalue-1-ref-orleans-serialization-buffers-reader-tinput-orleans-serializatio-d814a209/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/DictionaryCodec.cs#L78-L136)

```csharp
public Dictionary<TKey, TValue> DictionaryCodec<TKey, ReadValue<TInput>(ref Reader<TInput> reader, Field field)
```

Reads a value.

### Parameters

- `reader` (`Reader<TInput>`): The reader.
- `field` (`Field`): The field.

### Returns

The value.

## WriteField(Writer&lt;TBufferWriter&gt;, uint, Type, Dictionary&lt;TKey, TValue&gt;) {#writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-system-fa146e5d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.dictionarycodec-2/methods/writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-system-fa146e5d/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/DictionaryCodec.cs#L48-L73)

```csharp
public void DictionaryCodec<TKey, WriteField<TBufferWriter>(ref Writer<TBufferWriter> writer, uint fieldIdDelta, Type expectedType, Dictionary<TKey, TValue> value)
```

Writes a field.

### Parameters

- `writer` (`Writer<TBufferWriter>`): The writer.
- `fieldIdDelta` (`uint`): The field identifier delta.
- `expectedType` (`Type`): The expected type.
- `value` (`Dictionary<TKey, TValue>`): The value.
