using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace destructors { class Program { int i = 5; public Program() { Console.WriteLine("Object created"); } ~Program() { Console.WriteLine("Object destroyed"); } static void Main(string[] args) { Program p = new Program(); Console.WriteLine(p.i); p = null; GC.Collect(); Console.ReadLine(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)