📅  最后修改于: 2022-03-11 14:49:00.505000             🧑  作者: Mango
WeakReference foo = new WeakReference(new Foo());
((Foo)brokerRef.Target).Bar();
((Foo)brokerRef.Target).Baz();
GC.Collect();
GC.WaitForPendingFinalizers();
Assert.IsFalse(foo.IsAlive);