# ImmutableStackCodec&lt;T&gt; Methods

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

## ConvertFromSurrogate(ImmutableStackSurrogate&lt;T&gt;) {#convertfromsurrogate-ref-orleans-serialization-codecs-immutablestacksurrogate-t-a23bc45b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.immutablestackcodec-1/methods/convertfromsurrogate-ref-orleans-serialization-codecs-immutablestacksurrogate-t-a23bc45b/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/ImmutableStackCodec.cs#L28)

```csharp
public override ImmutableStack<T> ConvertFromSurrogate(ref ImmutableStackSurrogate<T> surrogate)
```

Converts a value from the surrogate type to the field type.

### Parameters

- `surrogate` (`ImmutableStackSurrogate<T>`): The surrogate.

### Returns

The value.

## ConvertToSurrogate(ImmutableStack&lt;T&gt;, ImmutableStackSurrogate&lt;T&gt;) {#converttosurrogate-system-collections-immutable-immutablestack-t-ref-orleans-ser-d21c7455}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.immutablestackcodec-1/methods/converttosurrogate-system-collections-immutable-immutablestack-t-ref-orleans-ser-d21c7455/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/ImmutableStackCodec.cs#L31)

```csharp
public override void ConvertToSurrogate(ImmutableStack<T> value, ref ImmutableStackSurrogate<T> surrogate)
```

Converts a value to the surrogate type.

### Parameters

- `value` (`ImmutableStack<T>`): The value.
- `surrogate` (`ImmutableStackSurrogate<T>`): The surrogate.
