public void Write(Stream stream, BaseDto dto) { var bytes = Serialize(dto); stream.Write(bytes, 0, bytes.Length); stream.Flush(); }
public byte[] Serialize(BaseDto dto) { using (var ms = new MemoryStream()) { Serializer.SerializeWithLengthPrefix(ms, dto, PrefixStyle.Base128, fieldNumber: 1); return(ms.ToArray()); } }