static void Main(string[] args) { ExampleIDisposable disposable = new ExampleIDisposable(new Dictionary <int, string> { { 5, "Object Composition" }, { 6, "Object Lifetime" } }); disposable.Dispose(); }
static void Main(string[] args) { ExampleIDisposable disposable = new ExampleIDisposable(new Dictionary <int, string> { { 5, "Object Composition" }, { 6, "Object Lifetime" } }); // Comment dispose and activate GC to see the difference. //disposable.Dispose(); GC.Collect(); }