/// <inheritdoc /> public virtual byte[] GetBytes(TType obj) { DefaultStreamWriterStrategy dest = new DefaultStreamWriterStrategy(); Write(obj, dest); return(dest.GetBytes()); }
public override byte[] GetBytes(TType obj) { DefaultStreamWriterStrategy capture = new DefaultStreamWriterStrategy(); //Must lock to protect shared buffer Write(obj, capture); return(capture.GetBytes().ToArray()); //make copy otherwise it may be shared buffer }
public byte[] Serialize <TTypeToSerialize>([NotNull] TTypeToSerialize data) { //Pass it to overload for custom writer using (DefaultStreamWriterStrategy writer = new DefaultStreamWriterStrategy()) { return(Serialize(data, writer)); } }