コード例 #1
0
        public TTo MapAll <TFrom, TTo>(Func <TFrom, TTo> function)
            where TFrom : class where TTo : class
        {
            var result1 = new FunctionMarshal <TFrom, TTo>(_result1 as TFrom, null).Map(function);
            var result2 = new FunctionMarshal <TFrom, TTo>(_result2 as TFrom, result1).Map(function);

            return(result2);
        }
コード例 #2
0
        /// <summary>
        /// Will convert both result types into another type and execute the same function
        /// regardless of which result was returned
        /// </summary>
        /// <typeparam name="T">The type to convert the results into</typeparam>
        /// <param name="function">The function to execute on the new result type</param>
        /// <returns>The functions result as the new result type</returns>
        public T MapAll <T>(Func <T, T> function)
            where T : class
        {
            var result1 = new FunctionMarshal <T, T>(_result1 as T, null).Map(function);
            var result2 = new FunctionMarshal <T, T>(_result2 as T, result1).Map(function);

            return(result2);
        }
コード例 #3
0
        private static FunctionMarshal <TOther1, TInvokerReturn> Map <TThis, TOther1, TInvokerReturn>(
            TThis thisResult,
            Func <TThis, TInvokerReturn> thisFunction,
            TOther1 otherResult1) where TInvokerReturn : class
        {
            var invokerResult = new FunctionMarshal <TThis, TInvokerReturn>(thisResult, null).Map(thisFunction);

            return(new FunctionMarshal <TOther1, TInvokerReturn>(otherResult1, invokerResult));
        }