# JsonDurableListCommandCodec&lt;T&gt; Methods

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

## Apply(JournalBufferReader, IDurableListCommandHandler&lt;T&gt;) {#apply-orleans-journaling-journalbufferreader-orleans-journaling-idurablelistcomm-262b1cea}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurablelistcommandcodec-1/methods/apply-orleans-journaling-journalbufferreader-orleans-journaling-idurablelistcomm-262b1cea/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableCollectionCommandCodecs.cs#L106-L115)

```csharp
public void Apply(JournalBufferReader input, IDurableListCommandHandler<T> consumer)
```

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

### Parameters

- `input` (`JournalBufferReader`)
- `consumer` (`IDurableListCommandHandler<T>`)

## WriteAdd(T, JournalStreamWriter) {#writeadd-t-orleans-journaling-journalstreamwriter-d8cde743}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurablelistcommandcodec-1/methods/writeadd-t-orleans-journaling-journalstreamwriter-d8cde743/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableCollectionCommandCodecs.cs#L17-L25)

```csharp
public void WriteAdd(T item, JournalStreamWriter writer)
```

Writes an add command.

### Parameters

- `item` (`T`)
- `writer` (`JournalStreamWriter`)

## WriteClear(JournalStreamWriter) {#writeclear-orleans-journaling-journalstreamwriter-3d89fe94}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurablelistcommandcodec-1/methods/writeclear-orleans-journaling-journalstreamwriter-3d89fe94/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableCollectionCommandCodecs.cs#L71-L75)

```csharp
public void WriteClear(JournalStreamWriter writer)
```

Writes a clear command.

### Parameters

- `writer` (`JournalStreamWriter`)

## WriteInsert(int, T, JournalStreamWriter) {#writeinsert-int-t-orleans-journaling-journalstreamwriter-39be83dc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurablelistcommandcodec-1/methods/writeinsert-int-t-orleans-journaling-journalstreamwriter-39be83dc/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableCollectionCommandCodecs.cs#L44-L53)

```csharp
public void WriteInsert(int index, T item, JournalStreamWriter writer)
```

Writes an insert command.

### Parameters

- `index` (`int`)
- `item` (`T`)
- `writer` (`JournalStreamWriter`)

## WriteRemoveAt(int, JournalStreamWriter) {#writeremoveat-int-orleans-journaling-journalstreamwriter-630f7ce1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurablelistcommandcodec-1/methods/writeremoveat-int-orleans-journaling-journalstreamwriter-630f7ce1/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableCollectionCommandCodecs.cs#L58-L66)

```csharp
public void WriteRemoveAt(int index, JournalStreamWriter writer)
```

Writes a remove-at command.

### Parameters

- `index` (`int`)
- `writer` (`JournalStreamWriter`)

## WriteSet(int, T, JournalStreamWriter) {#writeset-int-t-orleans-journaling-journalstreamwriter-bc881529}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurablelistcommandcodec-1/methods/writeset-int-t-orleans-journaling-journalstreamwriter-bc881529/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableCollectionCommandCodecs.cs#L30-L39)

```csharp
public void WriteSet(int index, T item, JournalStreamWriter writer)
```

Writes a set command.

### Parameters

- `index` (`int`)
- `item` (`T`)
- `writer` (`JournalStreamWriter`)

## WriteSnapshot(IReadOnlyCollection&lt;T&gt;, JournalStreamWriter) {#writesnapshot-system-collections-generic-ireadonlycollection-t-orleans-journalin-a79b18dc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.json.jsondurablelistcommandcodec-1/methods/writesnapshot-system-collections-generic-ireadonlycollection-t-orleans-journalin-a79b18dc/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/Formats/Json/JsonDurableCollectionCommandCodecs.cs#L80-L101)

```csharp
public void WriteSnapshot(IReadOnlyCollection<T> items, JournalStreamWriter writer)
```

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

### Parameters

- `items` (`IReadOnlyCollection<T>`)
- `writer` (`JournalStreamWriter`)
