static void Main(string[] args) { object a = ReturnResult(); ReturnResultFinal(a); SampleFinalizerClass b = new SampleFinalizerClass(); SampleNoFinalizeClass c = new SampleNoFinalizeClass(); SampleNoFinalizeClass d = new SampleNoFinalizeClass(); GarbageCollectorFinalize(c); Finalizer f = new Finalizer(); f = null; GC.Collect(); Console.ReadLine(); using (DisposeImplementation d1 = new DisposeImplementation()) { //throw new Exception("in here"); } DisposeImplementation d2 = new DisposeImplementation(); Console.ReadLine(); GC.Collect(); Console.ReadLine(); GC.WaitForPendingFinalizers(); }
static private void GarbageCollectorFinalize(SampleNoFinalizeClass a) { }