IO exception while reading/writing to file
<p>I am using an XML file to store the values. This XML file can be accessed from multiple methods.</p>

<pre><code>Private object lockObject = new object()

Method1
{
   Lock(this.lockObject)
   {
     MyCommonMethod()
   }
}

Timer.ElapseEvent
{
   Lock(this.lockObject)
   {
     MyCommonMethod()
   }
}

MyCommonMethod()
{
  // Read/Write to XML file.
  var element = XElement.Load(path);
  // some operations

   element.save(path)
}
</code></pre>

<p>This class is used by many other classes and some times it throws System.IO exception, the file is already used by other process , although I have used the lock statement</p>

<p>Please guide.</p>
