帮你写了个,把分全给我吧
using System.Xml;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"c:\test.xml");
XmlElement newElement = xmlDoc.CreateElement("Department");
newElement.SetAttribute("name", "CS");
for (int i = 0; i < xmlDoc.DocumentElement.ChildNodes.Count; i++)
newElement.AppendChild(xmlDoc.DocumentElement.ChildNodes[i--]);
xmlDoc.DocumentElement.AppendChild(newElement);
xmlDoc.Save(@"c:\result.xml");