delegate void foo();
public static void show(string foo)
{
MessageBox.Show(foo);
}
public void test()
{
DynamicMethod dm = new DynamicMethod("foo", null, null);
ILGenerator gen = dm.GetILGenerator();
gen.Emit(OpCodes.Ldstr, "hello world");
gen.EmitCall(OpCodes.Call, this.GetType().GetMethod("show"),null);
gen.Emit(OpCodes.Ret);
var b = dm.CreateDelegate(typeof(foo)) as foo;
b();
}