# Codec_ImmutableStackSurrogate&lt;T&gt; Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleanscodegen.orleans.serialization.codecs.codec-immutablestacksurrogate-1/)

## Deserialize(Reader&lt;TReaderInput&gt;, ImmutableStackSurrogate&lt;T&gt;) {#deserialize-1-ref-orleans-serialization-buffers-reader-treaderinput-ref-orleans-81fd461e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleanscodegen.orleans.serialization.codecs.codec-immutablestacksurrogate-1/methods/deserialize-1-ref-orleans-serialization-buffers-reader-treaderinput-ref-orleans-81fd461e/)

```csharp
public void Deserialize<TReaderInput>(ref Reader<TReaderInput> reader, scoped ref ImmutableStackSurrogate<T> instance)
```

Deserializes the specified type.

### Parameters

- `reader` (`Reader<TReaderInput>`): The reader.
- `instance` (`ImmutableStackSurrogate<T>`): The value.

## ReadValue(Reader&lt;TReaderInput&gt;, Field) {#readvalue-1-ref-orleans-serialization-buffers-reader-treaderinput-orleans-serial-1316d822}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleanscodegen.orleans.serialization.codecs.codec-immutablestacksurrogate-1/methods/readvalue-1-ref-orleans-serialization-buffers-reader-treaderinput-orleans-serial-1316d822/)

```csharp
public ImmutableStackSurrogate<T> ReadValue<TReaderInput>(ref Reader<TReaderInput> reader, Field field)
```

Reads a value.

### Parameters

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

### Returns

The value.

## Serialize(Writer&lt;TBufferWriter&gt;, ImmutableStackSurrogate&lt;T&gt;) {#serialize-1-ref-orleans-serialization-buffers-writer-tbufferwriter-ref-orleans-s-74d9ba63}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleanscodegen.orleans.serialization.codecs.codec-immutablestacksurrogate-1/methods/serialize-1-ref-orleans-serialization-buffers-writer-tbufferwriter-ref-orleans-s-74d9ba63/)

```csharp
public void Serialize<TBufferWriter>(ref Writer<TBufferWriter> writer, scoped ref ImmutableStackSurrogate<T> instance)
```

Serializes the provided value.

### Parameters

- `writer` (`Writer<TBufferWriter>`): The writer.
- `instance` (`ImmutableStackSurrogate<T>`): The value.

## WriteField(Writer&lt;TBufferWriter&gt;, uint, Type, ImmutableStackSurrogate&lt;T&gt;) {#writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-system-0896ef58}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleanscodegen.orleans.serialization.codecs.codec-immutablestacksurrogate-1/methods/writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-system-0896ef58/)

```csharp
public void WriteField<TBufferWriter>(ref Writer<TBufferWriter> writer, uint fieldIdDelta, Type expectedType, ImmutableStackSurrogate<T> value)
```

Writes a field.

### Parameters

- `writer` (`Writer<TBufferWriter>`): The writer.
- `fieldIdDelta` (`uint`): The field identifier delta.
- `expectedType` (`Type`): The expected type.
- `value` (`ImmutableStackSurrogate<T>`): The value.
