From 3e3d42023bbd4331daecc45de0d86df5f8c54c75 Mon Sep 17 00:00:00 2001 From: Patrick M <79525442+pmountsjmc@users.noreply.github.com> Date: Fri, 7 May 2021 13:24:09 -0700 Subject: [PATCH] Garbage collection for C# Added description and implementation of Garbage collection in the C#.txt file --- languages/C#.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/languages/C#.txt b/languages/C#.txt index b537983..aaf052d 100644 --- a/languages/C#.txt +++ b/languages/C#.txt @@ -398,3 +398,17 @@ CHEATSHEET C# KeyPress KeyPressEventHandler(object sender, KeyPressEventArgs e) +16. Garbage Collection + + 16.1 Using statements + //A using statement encapsulates the lifetime of an IDisposable object and auto manages memory + + using(SomeManagedClass smc){ + + //Scope of SomeManagedClass + + } + + //Garbage collection happens here and the CLR disposes the object + +