コード例 #1
0
        public T CallFunc <T>(Func <T> func)
        {
            var toFunc = new FuncConv <T>()
            {
                toCall = func
            };
            var helper = new CallHelperSafeHelper <bool, T>()
            {
                inData = true, toCall = new Func <bool, T>(toFunc.Call)
            };

            CallAction(helper.AsAction);
            return(helper.outData);
        }
コード例 #2
0
        public static O DefaultCallFunc <O>(Func <O> f)
        {
            var toFunc = new FuncConv <O>()
            {
                toCall = f
            };
            var helper = new CallHelperSafeHelper <bool, O>()
            {
                inData = true, toCall = new Func <bool, O>(toFunc.Call)
            };

            ExecutionContext.Run(EmptyExecutionContext.Empty, helper.AsContextCallback, null);
            return(helper.outData);
            //using (var t = Create())
            //{
            //    return t.CallFunc(f);
            //}
            //return Default.CallFunc(f);
        }