LazyProperty Mutator

Mutator that takes a readonly property and caches the result, i.e. makes it lazy. This laziness is not thread safe and keeps a strong reference to the result.

Example

class Foo {
    [Lazy]
    public int Value { 
        get { return Environment.Ticks; } 
    }
}
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
class LazyAttribute : Attribute {}
class Foo {
    int Value$Value; // compiler generated
    bool Value$Initialized;
    int GetValueUncached() { 
        return Environment.Ticks;
    }
    public int Value  {
        get {
            if(!this.Value$Initialized) {
                this.Value$Value = this.GetValueUncached();
                this.Value$Initialized = true;
            }
            return this.Value$Value;
        }
}

Requirements: