/// <summary> /// Restores inner state of an already created object passed in <paramref name="obj"/> parameter based on a saved XML. /// Works for results of <see cref="SerializeContent(XmlWriter,object,XmlSerializationOptions)"/> and other <c>SerializeContent</c> overloads. /// </summary> /// <param name="obj">The already constructed object whose inner state has to be deserialized.</param> /// <param name="reader">An <see cref="XmlReader"/> instance to be used to read the XML content. Reader must be in at correct position for the successful deserialization.</param> /// <exception cref="ArgumentNullException"><paramref name="obj"/> and <paramref name="reader"/> must not be <see langword="null"/>.</exception> /// <exception cref="ArgumentException"><paramref name="obj"/> must not be a value type.</exception> /// <exception cref="NotSupportedException">Deserializing an inner type is not supported.</exception> /// <exception cref="ReflectionException">An inner type cannot be instantiated or serialized XML content is corrupt.</exception> /// <exception cref="ArgumentException">XML content is inconsistent or corrupt.</exception> public static void DeserializeContent(XmlReader reader, object obj) => XmlReaderDeserializer.DeserializeContent(reader, obj);
/// <summary> /// Deserializes an object using the provided <see cref="XmlReader"/> in <paramref name="reader"/> parameter. /// </summary> /// <param name="reader">An <see cref="XmlReader"/> object to be used for deserialization.</param> /// <returns>The deserialized object.</returns> /// <remarks> /// <note> /// The <paramref name="reader"/> position must be <em>before</em> the content to deserialize. /// </note> /// </remarks> /// <exception cref="ArgumentNullException"><paramref name="reader"/> must not be <see langword="null"/>.</exception> /// <exception cref="NotSupportedException">Deserializing an inner type is not supported.</exception> /// <exception cref="ReflectionException">An inner type cannot be instantiated or serialized XML content is corrupt.</exception> /// <exception cref="ArgumentException">XML content is inconsistent or corrupt.</exception> /// <exception cref="XmlException">An error occurred while parsing the XML.</exception> public static object Deserialize(XmlReader reader) => XmlReaderDeserializer.Deserialize(reader);