I use the using statement as follows:

using (StreamReader reader = new StreamReader(path)) { // ... reader.Close(); } 

In the initialization string, a FileNotFoundException exception is FileNotFoundException

Could not find file '...'.

which throws out the constructor StreamReader , after which the program ends. Question: Doesn't the using statement include the default exception handling itself (call Dispose) and need to handle it yourself?

    2 answers 2

    As far as I understand, using no exceptions handles, for this you should use try / catch blocks.

      The using statement guarantees to call the Dispose method, even if an exception occurs in the object when the methods are called , because using is nothing but try / finally blocks. But by itself it does not handle any exceptions.