public Marshaller(Action<T, SerializationContext> serializer, Func<DeserializationContext, T> deserializer)
Initializes a new marshaller from serialize/deserialize fuctions that can access serialization and deserialization
context. Compared to the simple serializer/deserializer functions, using the contextual version provides more
flexibility and can lead to increased efficiency (and better performance).
Note: This constructor is part of an experimental API that can change or be removed without any prior notice.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eMarshaller<T>\u003c/code\u003e is a class that encapsulates the logic for serializing and deserializing messages in the Grpc.Core namespace, found in the Grpc.Core.Api.dll assembly.\u003c/p\u003e\n"],["\u003cp\u003eThis class provides two constructors for creating a marshaller, one using functions that take serialization and deserialization contexts, and the other using simple serializer/deserializer functions for byte arrays.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMarshaller<T>\u003c/code\u003e class offers four properties to retrieve the serializer and deserializer functions: \u003ccode\u003eContextualSerializer\u003c/code\u003e, \u003ccode\u003eContextualDeserializer\u003c/code\u003e, \u003ccode\u003eSerializer\u003c/code\u003e, and \u003ccode\u003eDeserializer\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMarshaller\u003c/code\u003e class inherits multiple members from the base \u003ccode\u003eobject\u003c/code\u003e class, including \u003ccode\u003eEquals\u003c/code\u003e, \u003ccode\u003eGetHashCode\u003c/code\u003e, and \u003ccode\u003eToString\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMarshaller\u003c/code\u003e class is available in different versions, such as 2.66.0, 2.63.0, and 2.48.0, with version 2.66.0 being the latest.\u003c/p\u003e\n"]]],[],null,["# Class Marshaller<T> (2.66.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.66.0 (latest)](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Marshaller-1)\n- [2.63.0](/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.Marshaller-1)\n- [2.48.0](/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.Marshaller-1) \n\n public class Marshaller\u003cT\u003e\n\nEncapsulates the logic for serializing and deserializing messages. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Marshaller\\\u003cT\\\u003e \n\nInherited Members\n-----------------\n\n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Grpc.Core](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)\n\nAssembly\n--------\n\nGrpc.Core.Api.dll\n\nConstructors\n------------\n\n### Marshaller(Action\\\u003cT, SerializationContext\\\u003e, Func\\\u003cDeserializationContext, T\\\u003e)\n\n public Marshaller(Action\u003cT, SerializationContext\u003e serializer, Func\u003cDeserializationContext, T\u003e deserializer)\n\nInitializes a new marshaller from serialize/deserialize fuctions that can access serialization and deserialization\ncontext. Compared to the simple serializer/deserializer functions, using the contextual version provides more\nflexibility and can lead to increased efficiency (and better performance).\nNote: This constructor is part of an experimental API that can change or be removed without any prior notice.\n\n### Marshaller(Func\\\u003cT, byte\\[\\]\\\u003e, Func\\\u003cbyte\\[\\], T\\\u003e)\n\n public Marshaller(Func\u003cT, byte[]\u003e serializer, Func\u003cbyte[], T\u003e deserializer)\n\nInitializes a new marshaller from simple serialize/deserialize functions.\n\nProperties\n----------\n\n### ContextualDeserializer\n\n public Func\u003cDeserializationContext, T\u003e ContextualDeserializer { get; }\n\nGets the serializer function.\nNote: experimental API that can change or be removed without any prior notice.\n\n### ContextualSerializer\n\n public Action\u003cT, SerializationContext\u003e ContextualSerializer { get; }\n\nGets the serializer function.\nNote: experimental API that can change or be removed without any prior notice.\n\n### Deserializer\n\n public Func\u003cbyte[], T\u003e Deserializer { get; }\n\nGets the deserializer function.\n\n### Serializer\n\n public Func\u003cT, byte[]\u003e Serializer { get; }\n\nGets the serializer function."]]