以下用C#编写并在Mono Droid上执行的代码无法按预期工作。
var strongRef = "abc";
WeakReference weakRef = new WeakReference (strongRef);
strongRef = null;
System.GC.Collect (2,GCCollectionMode.Forced);
System.Diagnostics.Debug.WriteLine ("Target:" + weakRef.Target + " IsAlive:" + weakRef.IsAlive);
预期O / P:目标:null IsAlive:false
实际O / P:目标:abc IsAlive:true