Thanks for the answer. As a result, I redid a little serialization in xml.
Initially, my parents had such attributes on the class.
[XmlInclude(typeof(Book)), XmlInclude(typeof(Newspaper))]
did serialization through the array
public class SerializeLibraryUnits { [XmlArrayItem(typeof(Book)), XmlArrayItem(typeof(Newspaper))] public LibraryUnit[] libraryUnits; }
as a result, xml became this kind
<SerializeLibraryUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <libraryUnits> <Book> <NameVal>книга1</NameVal> </Book> <Book> <NameVal>книга2</NameVal> </Book> <Newspaper> <NameVal>Газета3</NameVal> <pageCountVal>7</pageCountVal> </Newspaper> </libraryUnits> </SerializeLibraryUnits>
I study... ))