public static byte[] ToProtoBuf <T>(this T obj) { using var ms = MemoryStreamFactory.GetStream(); ProtoBufFormat.Serialize(obj, ms); var bytes = ms.ToArray(); return(bytes); }
public static byte[] ToProtoBuf <T>(this T obj) { using (var ms = new MemoryStream()) { ProtoBufFormat.Serialize(obj, ms); var bytes = ms.ToArray(); return(bytes); } }
public override void SerializeToStream(IRequest req, object request, Stream stream) { try { ProtoBufFormat.Serialize(req, request, stream); } catch (Exception ex) { throw new SerializationException("ProtoBufServiceClient: Error serializing: " + ex.Message, ex); } }