Here is my serialization function:
public static void SaveInXmlFormatt(List<Employee> objGraph, string fileName) { XmlSerializer xmlFormat = new XmlSerializer(typeof(List<Employee>)); using (Stream fStream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None)) { xmlFormat.Serialize(fStream, objGraph); } Console.WriteLine("--> Сохранение объекта в XML-формат"); } At the same time, the Employee class is the base class for the Manager and Clerk classes. My task is to serialize a List(Employee) that contains its classes of successors ( Manager , Clerk ). When this function is called, it throws a System.InvalidOperationException .