title: Using TextWriter.Synchronized or having lock in multithreaded file IO - C# WPF .net 4.5
body: <p>Ok there are 2 ways of writing text to a file in multi threaded system</p>
  
  <p>Which one is better than other</p>
  
  <p>First case : having a static object to lock streamwriter and do operations</p>
  
  <p>Second case having : </p>
  
  <pre><code>     TextWriter twWaitingToBeFetched;
       twWaitingToBeFetched = TextWriter.Synchronized(new StreamWriter(stringPath, true));
       twWaitingToBeFetched.WriteLine(srNewComposedUrl);
       twWaitingToBeFetched.Flush();
  </code></pre>
  
  <p>Now which one is better do you think and why ?</p>
  
  <p>I need multiple threads tasks to write same stream</p>
  
  <p>C# .net 4.5 - WPF application</p>