/// <summary>
        /// Serializes the public static properties of a type to a JSON structure.
        /// </summary>
        /// <typeparam name="T">The type to serialize.</typeparam>
        /// <returns>The JSON representation of the type.</returns>
        public JsonValue SerializeType <T>()
        {
            var serializer = SerializerFactory.GetTypeSerializer();
            var json       = serializer.SerializeType <T>(this);

            return(json);
        }
Esempio n. 2
0
        /// <summary>
        /// Serializes the public static properties of a type to a JSON structure.
        /// </summary>
        /// <typeparam name="T">The type to serialize.</typeparam>
        /// <returns>The JSON representation of the type.</returns>
        public JsonValue SerializeType <T>()
        {
            var serializer = SerializerFactory.GetTypeSerializer <T>(Options);
            var json       = serializer.SerializeType <T>(this);

            SerializationMap.Clear();
            return(json);
        }
        /// <summary>
        /// Deserializes a JSON structure to the public static properties of a type.
        /// </summary>
        /// <typeparam name="T">The type to deserialize.</typeparam>
        /// <param name="json">The JSON representation of the type.</param>
        /// <exception cref="TypeDoesNotContainPropertyException">Optionally thrown during automatic
        /// deserialization when the JSON contains a property which is not defined by the requested
        /// type.</exception>
        public void DeserializeType <T>(JsonValue json)
        {
            var serializer = SerializerFactory.GetTypeSerializer();

            serializer.DeserializeType <T>(json, this);
        }