PackTo() public method

Serialize specified object with specified Packer.
public PackTo ( Packer packer, object objectTree ) : void
packer Packer which packs values in .
objectTree object Object to be serialized.
return void
Exemplo n.º 1
0
        public static void Pack(this MessagePackSerializer source, Stream stream, object objectTree, PackerCompatibilityOptions packerCompatibilityOptions)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            // Packer does not have finalizer, so just avoiding packer disposing prevents stream closing.
            source.PackTo(Packer.Create(stream, packerCompatibilityOptions), objectTree);
        }