diff --git a/Exceptionhandling/Program.cs b/Exceptionhandling/Program.cs index 8128b38..3db9f0a 100644 --- a/Exceptionhandling/Program.cs +++ b/Exceptionhandling/Program.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -10,19 +11,12 @@ namespace Exceptionhandling { static void Main(string[] args) { + + StreamReader streamreader = null; try { - var calculator = new Calculator(); - var result = calculator.Divide(5, 0); - - } - catch (DivideByZeroException dx) - { - Console.WriteLine("You cannot divide by 0."); - } - catch (ArithmeticException ax) - { - Console.WriteLine(""); + streamreader = new StreamReader(@"c:\file.zip"); + var content = streamreader.ReadToEnd(); } catch (Exception ex) { @@ -30,6 +24,8 @@ namespace Exceptionhandling } finally { + if (streamreader != null) + streamreader.Dispose(); } } }