/// <summary> /// Wraps the given value in a WeakReference and returns a tree that will retrieve /// the value from the WeakReference. /// </summary> public static MemberExpression WeakConstant(object value) { System.Diagnostics.Debug.Assert(!(value is Expression)); return(Ast.ReadProperty( Ast.RuntimeConstant(new WeakReference(value)), typeof(WeakReference).GetProperty("Target") )); }