Using XML files with C#

Jul 16 2008 11:35 AM


I have written a code to update the contents of an existing xml file.

For updating I open the file using Load method as given below:


After updating the contents when i save the file using "Save" function as given below:


I get following exception:

"The process cannot access the file 'C:\BartechPasswords.xml' because it is being used by another process."

Do we need to firt close the file or unload the file. Please reply the post as soon as possible.

Thanks in advance.

Answers (8)