# Class Marshallers (2.66.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.66.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Marshallers)
- [2.63.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.Marshallers)
- [2.48.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.Marshallers)

    public static class Marshallers

Utilities for creating marshallers.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> Marshallers

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Grpc.Core](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)

## Assembly

Grpc.Core.Api.dll

## Properties

### StringMarshaller

    public static Marshaller<string> StringMarshaller { get; }

Returns a marshaller for `string` type. This is useful for testing.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Marshaller-1https://learn.microsoft.com/dotnet/api/system.string` |   |

## Methods

### Create\<T\>(Action\<T, SerializationContext\>, Func\<DeserializationContext, T\>)

    public static Marshaller<T> Create<T>(Action<T, SerializationContext> serializer, Func<DeserializationContext, T> deserializer)

Creates a marshaller from specified contextual serializer and deserializer.
Note: This method is part of an experimental API that can change or be removed without any prior notice.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `serializer` | `https://learn.microsoft.com/dotnet/api/system.action-2https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.SerializationContext` |
| `deserializer` | `https://learn.microsoft.com/dotnet/api/system.func-2https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.DeserializationContext` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Marshaller-1` |   |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `T` |   |

### Create\<T\>(Func\<T, byte\[\]\>, Func\<byte\[\], T\>)

    public static Marshaller<T> Create<T>(Func<T, byte[]> serializer, Func<byte[], T> deserializer)

Creates a marshaller from specified serializer and deserializer.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `serializer` | `https://learn.microsoft.com/dotnet/api/system.func-2System.Byte` |
| `deserializer` | `https://learn.microsoft.com/dotnet/api/system.func-2System.Byte` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Marshaller-1` |   |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `T` |   |