title: How to access a text file in c# that is being used by another process
body: <p>I have text file which is being been used by modscan to write data into the file. At a particular time I have to read the data and save in database. In offline mode ie; without modscan using it I can read the data and very well save in database. however as it online with modscan it gives exception </p>
  
  <blockquote>
    <p>Cannot access file as it been used by other process.</p>
  </blockquote>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>using System.IO;
  string path = dt.Rows[i][11].ToString();
  string[] lines = System.IO.File.ReadAllLines(@path);
  </code></pre>
  
  <p>path has <code>"E:\Metertxt\02.txt"</code></p>
  
  <p>So what changes I need to make in order to read it without interfering with modscan.
  I googled and I found this which might work, however I am not sure how to use it</p>
  
  <blockquote>
    <p>FileShare.ReadWrite</p>
  </blockquote>