Ejemplo n.º 1
0
        /// <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
        }