public static void RunDelegate3() { var delegateAction = FastMethodOperator.Random() .Body(@"var temp = obj;") .Compile <Action <string> >(); delegateAction?.Invoke("Hello"); Assert.NotNull(delegateAction); }
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); }
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); }