weak reference type c# code example
Example: c# week refrences
WeakReference foo = new WeakReference(new Foo());
((Foo)brokerRef.Target).Bar();
((Foo)brokerRef.Target).Baz();
GC.Collect();
GC.WaitForPendingFinalizers();
Assert.IsFalse(foo.IsAlive);