Hoksimilio
New Member
I am trying to reference my derived classes in a repository class I created.Here is the code:\[code\][XmlInclude(typeof(Case1))][XmlInclude(typeof(Case2))][XmlInclude(typeof(Case3))]public class FileRepo: IFileRepo{ public string Name { set; get; } public DateTime Time { get; set; } public bool Correct{ get; set; } public void SerializetoXml(IFileRepo repo) { var filename = string.Format("{0}__{1}", DateTime.Now.ToString("yyMMddhhss"), "Log.xml"); var path = @"C:\Temp; if (!Directory.Exists(path)) Directory.CreateDirectory(path); var fullpath = Path.Combine(path, filename); var serializer = new XmlSerializer((typeof(FileRepo))); var textwriter = new StreamWriter(fullpath); serializer.Serialize(textwriter, repo); textwriter.Close(); }}\[/code\]Basically I am trying to 'reference' all of those classes without having to put XmlInclude for each one. Please list any examples or references to solve this problem.