Is C#'s using statement abort-safe?
I've just finished reading "C# 4.0 in a Nutshell" (O'Reilly) and I think it's a great book for a programmer willing to switch to C#, but it left me wondering. My problem is the definition of using statement. According to the book (p. 138), using (StreamReader reader = File.OpenText("file.txt")) { ... } is precisely equivalent to: StreamReader reader = File.OpenText("file.txt"); try { ... } finally { if (reader != null) ((IDisposable)reader).Dispose(); } Suppose, however, that this is true and that this code is executed in a separate thread. This thread is now aborted with thread.Abort() , so a