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