# SerializationHostingExtensions Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization.messagepack/orleans.serialization.serializationhostingextensions/)

## AddMessagePackSerializer(ISerializerBuilder, Func&lt;Type, bool&gt;, Func&lt;Type, bool&gt;, MessagePackSerializerOptions) {#addmessagepackserializer-this-orleans-serialization-iserializerbuilder-system-fu-37202361}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization.messagepack/orleans.serialization.serializationhostingextensions/methods/addmessagepackserializer-this-orleans-serialization-iserializerbuilder-system-fu-37202361/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization.MessagePack/SerializationHostingExtensions.cs#L32-L42)

```csharp
public static ISerializerBuilder AddMessagePackSerializer(this ISerializerBuilder serializerBuilder, Func<Type, bool> isSerializable = null, Func<Type, bool> isCopyable = null, MessagePackSerializerOptions messagePackSerializerOptions = null)
```

Adds support for serializing and deserializing values using `MessagePack.MessagePackSerializer`.

### Parameters

- `serializerBuilder` (`ISerializerBuilder`): The serializer builder.
- `isSerializable` (`Func<Type, bool>`): A delegate used to indicate which types should be serialized by this codec.
- `isCopyable` (`Func<Type, bool>`): A delegate used to indicate which types should be copied by this codec.
- `messagePackSerializerOptions` (`MessagePackSerializerOptions`): The MessagePack serializer options.

## AddMessagePackSerializer(ISerializerBuilder, Func&lt;Type, bool&gt;, Func&lt;Type, bool&gt;, Action&lt;OptionsBuilder&lt;MessagePackCodecOptions&gt;&gt;) {#addmessagepackserializer-this-orleans-serialization-iserializerbuilder-system-fu-15ec0a4a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization.messagepack/orleans.serialization.serializationhostingextensions/methods/addmessagepackserializer-this-orleans-serialization-iserializerbuilder-system-fu-15ec0a4a/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization.MessagePack/SerializationHostingExtensions.cs#L58-L91)

```csharp
public static ISerializerBuilder AddMessagePackSerializer(this ISerializerBuilder serializerBuilder, Func<Type, bool> isSerializable, Func<Type, bool> isCopyable, Action<OptionsBuilder<MessagePackCodecOptions>> configureOptions = null)
```

Adds support for serializing and deserializing values using `MessagePack.MessagePackSerializer`.

### Parameters

- `serializerBuilder` (`ISerializerBuilder`): The serializer builder.
- `isSerializable` (`Func<Type, bool>`): A delegate used to indicate which types should be serialized by this codec.
- `isCopyable` (`Func<Type, bool>`): A delegate used to indicate which types should be copied by this codec.
- `configureOptions` (`Action<OptionsBuilder<MessagePackCodecOptions>>`): A delegate used to configure the options for the MessagePack codec.
