Beispiel #1
0
        /// <summary>
        /// Deserializes tag data into an object.
        /// </summary>
        /// <param name="context">The serialization context to use.</param>
        /// <param name="structureType">The type of object to deserialize the tag data as.</param>
        /// <returns>The object that was read.</returns>
        public object Deserialize(ISerializationContext context, Type structureType)
        {
            var info   = new TagStructureInfo(structureType, _version);
            var reader = context.BeginDeserialize(info);
            var result = DeserializeStruct(reader, context, info);

            context.EndDeserialize(info, result);
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Deserializes tag data into an object.
        /// </summary>
        /// <typeparam name="T">The type of object to deserialize the tag data as.</typeparam>
        /// <param name="context">The serialization context to use.</param>
        /// <returns>The object that was read.</returns>
        public static T Deserialize <T>(ISerializationContext context)
        {
            // TODO: Add support for tag inheritance
            var reader = context.BeginDeserialize();
            var result = (T)DeserializeStruct(reader, context, typeof(T));

            context.EndDeserialize(result);
            return(result);
        }