What’s a good way to write files inside tasks running in different classes?

I have 4 different classes each running a list<Task> and each task ends with File.WriteAllText() and it's giving me trouble. So I put a lock before the file writing. So, now I'm wondering, if this will create problems since each class has it's own lock and maybe I should have a global lock for all classes to share…

Any suggestions?

by codinghandyman via /r/csharp

Leave a Reply