using System; namespace Google.GRPC.Core { /// /// For serializing and deserializing messages. /// public interface IMarshaller { byte[] Serialize(T value); T Deserialize(byte[] payload); } /// /// UTF-8 Marshalling for string. Useful for testing. /// internal class StringMarshaller : IMarshaller { public byte[] Serialize(string value) { return System.Text.Encoding.UTF8.GetBytes(value); } public string Deserialize(byte[] payload) { return System.Text.Encoding.UTF8.GetString(payload); } } }