public byte[] Encode <T>(T obj) { if (obj == null) { throw new ArgumentNullException("The object to be serialized cannot be null."); } var raw = ProtocolBuffersConvert.SerializeObject <T>(obj); if (CompressionEnabled) { return(GZipCompression.Compress(raw)); } else { return(raw); } }
public byte[] EncodeMessage(object message) { if (message == null) { throw new ArgumentNullException("The message which is to be serialized cannot be null."); } var raw = ProtocolBuffersConvert.SerializeObject(message); if (CompressionEnabled) { return(GZipCompression.Compress(raw)); } else { return(raw); } }