# NameValueCollectionCodec Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.namevaluecollectioncodec/)

## ConvertFromSurrogate(NameValueCollectionSurrogate) {#convertfromsurrogate-ref-orleans-serialization-codecs-namevaluecollectionsurroga-5ef3b6e9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.namevaluecollectioncodec/methods/convertfromsurrogate-ref-orleans-serialization-codecs-namevaluecollectionsurroga-5ef3b6e9/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/NameValueCollectionCodec.cs#L26-L32)

```csharp
public override NameValueCollection ConvertFromSurrogate(ref NameValueCollectionSurrogate surrogate)
```

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

### Parameters

- `surrogate` (`NameValueCollectionSurrogate`): The surrogate.

### Returns

The value.

## ConvertToSurrogate(NameValueCollection, NameValueCollectionSurrogate) {#converttosurrogate-system-collections-specialized-namevaluecollection-ref-orlean-324cabbf}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.namevaluecollectioncodec/methods/converttosurrogate-system-collections-specialized-namevaluecollection-ref-orlean-324cabbf/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/NameValueCollectionCodec.cs#L38-L45)

```csharp
public override void ConvertToSurrogate(NameValueCollection value, ref NameValueCollectionSurrogate surrogate)
```

Converts a value to the surrogate type.

### Parameters

- `value` (`NameValueCollection`): The value.
- `surrogate` (`NameValueCollectionSurrogate`): The surrogate.
