public class Item { private string code; public string Code { get { return code; } set { code = value; } } public Item() { } public Item( string filename ) { XmlDocument doc = new XmlDocument(); doc.Load(filename); code = doc.SelectSingleNode("/item/code").InnerText; } public void Save( string filename ) { XmlDocument doc = new XmlDocument(); XmlElement itemElement = doc.CreateElement("item"); doc.AppendChild(itemElement); XmlElement codeElement = doc.CreateElement("code"); itemElement.AppendChild(codeElement); codeElement.InnerText = code; doc.Save(filename); } }