static unsafe void Main(string[] args)
{
//参数
var dic = Expression.Parameter(typeof(Dictionary<string, string>), "dic");
var pa = Expression.Parameter(typeof(string), "i");
//本地变量
var loc = Expression.Variable(typeof(int), "str");
//创建LabelTarget用来返回值
LabelTarget labelTarget = Expression.Label(typeof(int));
//调用i.ToString()
MethodCallExpression med = Expression.Call(dicVMethod, dic,pa);
var intValue = Expression.Call(StrToInMethod, med);
var dob = Expression.Call(DoubleIntMethod, intValue);
//将结果赋值给本地字符串变量
BinaryExpression asn = Expression.Assign(loc, dob);
//创建返回表达式(实际上就是Goto表达式)
GotoExpression ret = Expression.Return(labelTarget, loc);
//创建返回表达式的目标Label
LabelExpression lbl = Expression.Label(labelTarget, Expression.Constant(0,typeof(int)));
//生成BlockExpression
BlockExpression blocks = Expression.Block(new ParameterExpression[] { loc },asn,ret,lbl);
//生成Lambda表达式
Expression<DictionaryValueHandle> lam = Expression.Lambda<DictionaryValueHandle>(blocks,new ParameterExpression[] { dic,pa });
//运行并输出结果
DictionaryValueHandle del = lam.Compile();
Dictionary<string, string> m_Dic = new Dictionary<string, string>();
m_Dic["my"] = "123";
m_Dic["relPath"] = "C:\\we\\345.docx";
m_Dic["callback"] = "callback123456";
m_Dic["MyFuc"] = "{\"key\":\"key\",\"ke1y\":\"key1\",\"key2\":\"key3\"}";
Console.WriteLine(del(m_Dic, "my"));