private void button5_Click(object sender, EventArgs e) { textBox1.Clear(); XDocument xdoc = XDocument.Load("student.xml"); var list = from elem in xdoc.Element("ArrayOfStudent").Elements("Student") orderby Convert.ToInt32(elem.Element("averagemark").Value) select elem; foreach (var elem in list) { textBox1.Text += elem.Element("FIO").Value + " " + elem.Element("Specialty").Value + " " + elem.Element("group").Value + " " + elem.Element("averagemark").Value + Environment.NewLine; } if (sender is Button) { Button button6 = (Button)sender; if (button6.Name == "button6") { foreach (var elem in list) { XmlSerializeWrapper.Serialize <XElement>(elem, "sortstud.xml"); } } } }
private void button2_Click(object sender, EventArgs e) { XmlSerializeWrapper.Serialize(students, "student.xml"); }