Month: July 2013

More Memoization

I had to cache the results a couple methods recently, and only after I had done it a few times, I realized I should just write a memoization extension for System.Func. public static Func Memoize(this Func func) { Dictionary dict = new Dictionary(); return input => { if (!dict.ContainsKey(input)) { dict[input] = func(input); } return […]

More