/// <summary>
        /// Deserialize into an existing IBinarySerializable object.
        /// </summary>
        /// <param name="buffer">The buffer containing the serialized data.</param>
        /// <param name="start">The start index in the buffer of the serialized object.</param>
        /// <param name="value">The deserialized object.</param>
        /// <returns>The number of deserialized bytes.</returns>
        public uint FromBytesOverwrite(Buffer buffer, uint start, IBinarySerializable value)
        {
            Type type;

            CheckDeserializationParameters(buffer, start);

            uint read = FromBytes(buffer, start, out type);

            if (type != null)
            {
                if (!type.IsAssignableFrom(value.GetType()))
                {
                    throw new FormatException("The type of IBynarySerializable object does not match the provided object.");
                }

                read += value.FromBytes(this, buffer, start + read);
            }
            else
            {
                // Nothing to do: we got nothing to deserialize and the value already exists, so returning null is not an option.
                // It would be great to notify the user, but we do have a mecanism for that, and raising an exception would stop
                // the deserialization, but this should just be a warning.
            }

            return(read);
        }
        /// <summary>
        /// Deserialize a IBinarySerializable object.
        /// </summary>
        /// <param name="buffer">The buffer containing the serialized data.</param>
        /// <param name="start">The start index in the buffer of the serialized object.</param>
        /// <param name="value">The deserialized object.</param>
        /// <returns>The number of deserialized bytes.</returns>
        public uint FromBytes(Buffer buffer, uint start, out IBinarySerializable value)
        {
            Type type;

            CheckDeserializationParameters(buffer, start);

            uint read = FromBytes(buffer, start, out type);

            if (type != null)
            {
                CallDefaultConstructor(type, out value);

                read += value.FromBytes(this, buffer, start + read);
            }
            else
            {
                value = null;
            }

            return(read);
        }