Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // What will be the output?
- using System;
- class A : IDisposable
- {
- public A()
- {
- throw new Exception("A::Exception");
- }
- public void Do()
- {
- Console.WriteLine("A::Do()");
- }
- public void Dispose()
- {
- Console.WriteLine("A::Dispose()");
- }
- }
- public class Program
- {
- static void Main(string[] args)
- {
- try
- {
- using (var a = new A())
- {
- a.Do();
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
- }
- }
Add Comment
Please, Sign In to add comment