private T InternalDeserialize <T>(Type type, XElement element) { var serializer = _xmlSerializerCache.Resolve(type, element.Name.LocalName); var result = serializer.Deserialize(element.CreateReader()); return((T)result); }
private void WriteElements <T>(IList <T> elements, string section) { if (elements?.Any() != true) { return; } _xmlWriter.WriteStartElement(section); foreach (var element in elements) { var name = _componentResolver.ResolveName(element.GetType()); var serializer = _serializerCache.Resolve(element.GetType(), name); serializer.Serialize(_xmlWriter, element, _namespaces); } _xmlWriter.WriteEndElement(); }