Now I've created my first DLR program via change myscript's code.
1 LambdaExpression lexp;
2 LambdaBuilder lbm = AstUtils.Lambda(typeof(object), "Hello");
3 Expression a = lbm.CreateLocalVariable("a", typeof(string));
4 Expression asign=Expression.Assign(a, Expression.Constant("hello,fengzili"));
5 MethodInfo mif = typeof(Console).GetMethod("WriteLine", new Type[] { typeof(string) });
6 lbm.Body = AstUtils.Block(this.span,asign, Expression.Call(mif, a));
7 lexp = lbm.MakeLambda();
8 Delegate dlg = lexp.Compile();
9 dlg.DynamicInvoke();
10 return lexp;
2 LambdaBuilder lbm = AstUtils.Lambda(typeof(object), "Hello");
3 Expression a = lbm.CreateLocalVariable("a", typeof(string));
4 Expression asign=Expression.Assign(a, Expression.Constant("hello,fengzili"));
5 MethodInfo mif = typeof(Console).GetMethod("WriteLine", new Type[] { typeof(string) });
6 lbm.Body = AstUtils.Block(this.span,asign, Expression.Call(mif, a));
7 lexp = lbm.MakeLambda();
8 Delegate dlg = lexp.Compile();
9 dlg.DynamicInvoke();
10 return lexp;