The first time I called this function, everything went well, but the
second time I called it. An Exception thrown, do you know why?
An unhandled exception of type 'System.IO.IOEx ception' occurred in
mscorlib.dll
Additional information: The process cannot access the file
"E:\......\bin\ Debug\test.xml" because it is being used by another process.
----------------------------------------------
public void updateXMLFile()
{
string AppPath = System.Windows. Forms.Applicati on.StartupPath;
System.Xml.XmlT extWriter XMLWriter = new
System.Xml.XmlT extWriter(AppPa th + "/test.xml", System.Text.Enc oding.UTF8);
XMLWriter.Forma tting = System.Xml.Form atting.Indented ;
XMLWriter.Inden tation = 1;
/// <summary>
/// <?xml version="1.0" encoding="UTF-8"?>
/// </summary>
XMLWriter.Write StartDocument() ;
/// <summary>
/// <root>
/// </summary>
XMLWriter.Write StartElement("r oot");
/// <summary>
/// </root>
/// </summary>
XMLWriter.Write EndElement();
XMLWriter.Write EndDocument();
XMLWriter.Flush ();
XMLWriter.Close ();
}
----------------------------------------------