Welcome to MSDN Blogs Sign in | Join | Help

August 2006 - Posts

When GC.KeepAlive Doesn’t

The purpose of GC.KeepAlive(Object) is to tell the GC not to collect an object until a certain point. For example: class MyObject { ~MyObject() { Console.WriteLine(“MyObject Finalized”); } public static void Main() { MyObject obj = new MyObject(); LongRunningMethod();
Posted by clyon | 6 Comments
Filed under:
 
Page view tracker