# ReadOnlyCollectionCodec&lt;T&gt; Methods

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

## ConvertFromSurrogate(ReadOnlyCollectionSurrogate&lt;T&gt;) {#convertfromsurrogate-ref-orleans-serialization-codecs-readonlycollectionsurrogat-f0863fcd}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.readonlycollectioncodec-1/methods/convertfromsurrogate-ref-orleans-serialization-codecs-readonlycollectionsurrogat-f0863fcd/)

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

```csharp
public override ReadOnlyCollection<T> ConvertFromSurrogate(ref ReadOnlyCollectionSurrogate<T> surrogate)
```

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

### Parameters

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

### Returns

The value.

## ConvertToSurrogate(ReadOnlyCollection&lt;T&gt;, ReadOnlyCollectionSurrogate&lt;T&gt;) {#converttosurrogate-system-collections-objectmodel-readonlycollection-t-ref-orlea-e2fc860b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.readonlycollectioncodec-1/methods/converttosurrogate-system-collections-objectmodel-readonlycollection-t-ref-orlea-e2fc860b/)

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

```csharp
public override void ConvertToSurrogate(ReadOnlyCollection<T> value, ref ReadOnlyCollectionSurrogate<T> surrogate)
```

Converts a value to the surrogate type.

### Parameters

- `value` (`ReadOnlyCollection<T>`): The value.
- `surrogate` (`ReadOnlyCollectionSurrogate<T>`): The surrogate.
