WeakLazyProperty Mutator

Mutator that takes a property getter and caches the result in a weak reference. This laziness is not thread safe and assumes that the property value is never null.

Example

class Foo {
    [WeakLazy]
    public object Value { 
        get { return Environment.Ticks.ToString(); } 
    }
}
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
class WeakLazyAttribute : Attribute {}
class Foo {
    WeakReference value$Weak;
    string GetValueUncached() { 
        return Environment.Ticks.ToString();
    }
    public object Value  {
        get {
            var value = this.value$Weak != null ? (this.value$Weak.Value as string) : null;
            if(value == null)
                this.value$Weak = new WeakReference(value = this.GetValueUncached());
            return value;
        }
    }
}

Requirements: