CSharp examples for Custom Type:try catch finally
No exceptions occur in called method and run the finally branch
using System;/*from ww w . j a v a 2s . c o m*/ class UsingExceptions { static void Main() { // No exceptions occur in called method Console.WriteLine("Calling DoesNotThrowException"); DoesNotThrowException(); } // no exceptions thrown static void DoesNotThrowException() { // try block does not throw any exceptions try { Console.WriteLine("In DoesNotThrowException"); } catch { Console.WriteLine("This catch never executes"); } finally { Console.WriteLine("finally executed in DoesNotThrowException"); } Console.WriteLine("End of DoesNotThrowException"); } }