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

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurabledictionarycommandcodec-2/)

## Apply(JournalBufferReader, IDurableDictionaryCommandHandler&lt;TKey, TValue&gt;) {#apply-orleans-journaling-journalbufferreader-orleans-journaling-idurabledictiona-1afa42ec}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurabledictionarycommandcodec-2/methods/apply-orleans-journaling-journalbufferreader-orleans-journaling-idurabledictiona-1afa42ec/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableDictionaryCommandCodec.cs#L90-L99)

```csharp
public void JsonDurableDictionaryCommandCodec<TKey, Apply(JournalBufferReader input, IDurableDictionaryCommandHandler<TKey, TValue> consumer)
```

Reads one encoded command and applies it to `consumer`.

### Parameters

- `input` (`JournalBufferReader`)
- `consumer` (`IDurableDictionaryCommandHandler<TKey, TValue>`)

## WriteClear(JournalStreamWriter) {#writeclear-orleans-journaling-journalstreamwriter-50010eca}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurabledictionarycommandcodec-2/methods/writeclear-orleans-journaling-journalstreamwriter-50010eca/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableDictionaryCommandCodec.cs#L51-L55)

```csharp
public void JsonDurableDictionaryCommandCodec<TKey, WriteClear(JournalStreamWriter writer)
```

Writes a clear command.

### Parameters

- `writer` (`JournalStreamWriter`)

## WriteRemove(TKey, JournalStreamWriter) {#writeremove-tkey-orleans-journaling-journalstreamwriter-d9c62a19}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurabledictionarycommandcodec-2/methods/writeremove-tkey-orleans-journaling-journalstreamwriter-d9c62a19/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableDictionaryCommandCodec.cs#L38-L46)

```csharp
public void JsonDurableDictionaryCommandCodec<TKey, WriteRemove(TKey key, JournalStreamWriter writer)
```

Writes a remove command.

### Parameters

- `key` (`TKey`)
- `writer` (`JournalStreamWriter`)

## WriteSet(TKey, TValue, JournalStreamWriter) {#writeset-tkey-tvalue-orleans-journaling-journalstreamwriter-bf64e70b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurabledictionarycommandcodec-2/methods/writeset-tkey-tvalue-orleans-journaling-journalstreamwriter-bf64e70b/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableDictionaryCommandCodec.cs#L24-L33)

```csharp
public void JsonDurableDictionaryCommandCodec<TKey, WriteSet(TKey key, TValue value, JournalStreamWriter writer)
```

Writes a set command.

### Parameters

- `key` (`TKey`)
- `value` (`TValue`)
- `writer` (`JournalStreamWriter`)

## WriteSnapshot(IReadOnlyCollection&lt;KeyValuePair&lt;TKey, TValue&gt;&gt;, JournalStreamWriter) {#writesnapshot-system-collections-generic-ireadonlycollection-system-collections-4a5bef42}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurabledictionarycommandcodec-2/methods/writesnapshot-system-collections-generic-ireadonlycollection-system-collections-4a5bef42/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableDictionaryCommandCodec.cs#L60-L85)

```csharp
public void JsonDurableDictionaryCommandCodec<TKey, WriteSnapshot(IReadOnlyCollection<KeyValuePair<TKey, TValue>> items, JournalStreamWriter writer)
```

Writes a snapshot command, deriving the item count from `items`.

### Parameters

- `items` (`IReadOnlyCollection<KeyValuePair<TKey, TValue>>`)
- `writer` (`JournalStreamWriter`)
