Beispiel #1
0
        public static Func <T1, T2, T3, T4, T5, T6, T7, TResult> Memoize <T1, T2, T3, T4, T5, T6, T7, TResult>(this Func <T1, T2, T3, T4, T5, T6, T7, TResult> @this)
        {
            Guard.NotNull(@this, "@this");
            var dictionary = new LazySelectionDictionary <Tuple <T1, T2, T3, T4, T5, T6, T7>, TResult>(x => @this(x.Item1, x.Item2, x.Item3, x.Item4, x.Item5, x.Item6, x.Item7).ToMaybe());

            return((t1, t2, t3, t4, t5, t6, t7) => dictionary[new Tuple <T1, T2, T3, T4, T5, T6, T7>(t1, t2, t3, t4, t5, t6, t7)]);
        }
Beispiel #2
0
        public static Func <T1, T2, T3, TResult> Memoize <T1, T2, T3, TResult>(this Func <T1, T2, T3, TResult> @this)
        {
            Guard.NotNull(@this, "@this");
            var dictionary = new LazySelectionDictionary <Tuple <T1, T2, T3>, TResult>(x => @this(x.Item1, x.Item2, x.Item3).ToMaybe());

            return((t1, t2, t3) => dictionary[new Tuple <T1, T2, T3>(t1, t2, t3)]);
        }