diff --git a/Powerpoint Examples/Powerpoint 2/p7-descturct.cs b/Powerpoint Examples/Powerpoint 2/p7-descturct.cs new file mode 100644 index 0000000..97e1f54 --- /dev/null +++ b/Powerpoint Examples/Powerpoint 2/p7-descturct.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace destructor +{ + class DisposeTest : IDisposable + { + + public void Dispose() + { + Console.WriteLine("Cleaning up DisposeTest!"); + } + } + + class DestructTest + { + ~DestructTest() + { + Console.WriteLine("Cleaning up Destruct Test"); + } + } + + class Program + { + static void Main(string[] args) + { + { + DestructTest t2 = new DestructTest(); + + } + + Console.WriteLine("top"); + using (DisposeTest t = new DisposeTest()) + { + + } + Console.WriteLine("bottom"); + } + } +}