public static void Main(string[] args) { var a = new ResourceConsumer("First"); Run(); GC.Collect(); //forcing garbage-collection a.Consume(101); AppDomain dom = AppDomain.CreateDomain("secondary"); dom.DoCallBack(delegate() { var c = new ResourceConsumer("Third"); c.Consume(103); var d = new ResourceConsumer("Fourth"); d.Consume(104); d.Dispose(); }); AppDomain.Unload(dom); try { Run(args[0]); } catch {} Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
public static void Main(string[] args) { var a = new ResourceConsumer("First"); a.Apply(23); a.Dispose(); try { Run(args[0]); } catch {} }