Beispiel #1
0
        internal Lazy <TTransformResult> AddLazyOperationWithTransform <TResult, TTransformResult>(ILazyOperation operation, Func <TResult, TTransformResult> transformFunc, Action <TResult> onEval)
        {
            pendingLazyOperations.Add(operation);
            var lazyValue = new Lazy <TTransformResult>(() =>
            {
                ExecuteAllPendingLazyOperations();
                return(transformFunc((TResult)operation.Result));
            });

            if (onEval != null)
            {
                onEvaluateLazy[operation] = theResult => onEval((TResult)theResult);
            }

            return(lazyValue);
        }