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

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

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

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.idurabledictionarycommandcodec-2/methods/apply-orleans-journaling-journalbufferreader-orleans-journaling-idurabledictiona-03f6d04d/)

```csharp
public abstract void IDurableDictionaryCommandCodec<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-eefc15ad}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.idurabledictionarycommandcodec-2/methods/writeclear-orleans-journaling-journalstreamwriter-eefc15ad/)

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

Writes a clear command.

### Parameters

- `writer` (`JournalStreamWriter`)

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

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.idurabledictionarycommandcodec-2/methods/writeremove-tkey-orleans-journaling-journalstreamwriter-605a1b74/)

```csharp
public abstract void IDurableDictionaryCommandCodec<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-4b454828}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.idurabledictionarycommandcodec-2/methods/writeset-tkey-tvalue-orleans-journaling-journalstreamwriter-4b454828/)

```csharp
public abstract void IDurableDictionaryCommandCodec<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-875d9f9d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.idurabledictionarycommandcodec-2/methods/writesnapshot-system-collections-generic-ireadonlycollection-system-collections-875d9f9d/)

```csharp
public abstract void IDurableDictionaryCommandCodec<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`)
