Receiving notifications when garbage collections occur

While creating the 3rd Edition of my CLR via C# book (http://www.amazon.com/CLR-via-C-Third-Pro-Developer/dp/0735627045/ref=dp_ob_title_bk), I came up with a cool little class that will raise an event after a collection of Generation 0 or Generation 2 occurs. Here is the code for the class:


public static class GCNotification {
   private static Action<Int32> s_gcDone = null; // The event's field
   public static event Action<Int32> GCDone {
      add {
         // If there were no registered...

 •  0 comments  •  flag
Share on Twitter
Published on December 21, 2009 19:58
No comments have been added yet.


Jeffrey Richter's Blog

Jeffrey Richter
Jeffrey Richter isn't a Goodreads Author (yet), but they do have a blog, so here are some recent posts imported from their feed.
Follow Jeffrey Richter's blog with rss.