title: how to clear text file content c#
body: <p>i want clear text file contet with this method</p>
  
  <pre><code>private void writeTextFile(string filePath, string text)
  {
      if (!File.Exists(filePath))
      {
          File.Create(filePath).Close();
  
      }
      using (StreamWriter tw = new StreamWriter(filePath))
      {
          File.WriteAllText(filePath,"");
          tw.WriteLine(text);
          tw.Close();
      }
  }
  </code></pre>
  
  <p>but i get this error</p>
  
  <pre><code>The process cannot access the file  because it is being used by another process.
  </code></pre>
  
  <p>but this not open in anywhere , </p>
  
  <p>please help me
  thank's</p>