public void ExportFromXml(ImoptAndExport a) //从本地的xml文件中导入课程表信息到list中 { using (XmlReader reader = XmlReader.Create("D:\\classtable.xml")) { XmlSerializer xz = new XmlSerializer(a.temp.GetType()); a.temp = (List <Lesson>)xz.Deserialize(reader); } }
static void Main(string[] args) { StreamReader reader = new StreamReader("D:\\classtable2.txt", Encoding.Default); string a = reader.ReadToEnd(); GetInformation b = new GetInformation(); //获取课程信息的对象 string[] temp = b.Get(a); //保存一个学生所有课程的数组 LessonList c = new LessonList(); c.Match(temp); ImoptAndExport fun = new ImoptAndExport(); fun.ImportToXml(c.lessonList); fun.ExportFromXml(fun); c.lessonList = fun.temp; }