Beispiel #1
0
        public static void RunDelegate3()
        {
            var delegateAction = FastMethodOperator.Random()
                                 .Body(@"var temp = obj;")
                                 .Compile <Action <string> >();

            delegateAction?.Invoke("Hello");
            Assert.NotNull(delegateAction);
        }
Beispiel #2
0
        public static void RunDelegate2()
        {
            var delegateAction = FastMethodOperator.Random()
                                 .Body(@"return arg1 +"" ""+ arg2;")
                                 .Compile <Func <string, string, string> >();

            string result = delegateAction?.Invoke("Hello", "World2!");

            Assert.Equal("Hello World2!", result);
        }
Beispiel #3
0
        public static void RunDelegate1()
        {
            var delegateAction = FastMethodOperator
                                 .Random()
                                 .Param <string>("str1")
                                 .Param <string>("str2")
                                 .Body(@"
                            string result = str1 +"" ""+ str2;
                            return result;")
                                 .Return <string>()
                                 .Compile <Func <string, string, string> >();

            string result = delegateAction?.Invoke("Hello", "World2!");

            Assert.Equal("Hello World2!", result);
        }