using System; using System.Collections.Generic; using System.Text; namespace OpenRa.FileFormats { public class Lazy { Func p; T value; public Lazy(Func p) { if (p == null) throw new ArgumentNullException(); this.p = p; } public T Value { get { if (p == null) return value; value = p(); p = null; return value; } } } public static class Lazy { public static Lazy New(Func p) { return new Lazy(p); } } }