Is CreateDirectory() in C# thread-safe?
问题 Can I safely attempt to create the same directory from two different threads, without having one of them throw an exception, or run into other issues? Note that according to MSDN, it is OK to call CreateDirectory() on a directory which already exists, in which case the method is expected to do nothing. 回答1: The Directory.CreateDirectory call itself is safe to make from multiple threads. It will not corrupt program or file system state if you do so. However it's not possible to call Directory