这样写
var method = typeBldr.DefineMethod("GetIdValue"
, MethodAttributes.Family | MethodAttributes.HideBySig
| MethodAttributes.Virtual);
method.SetReturnType(typeof(object));
ILGenerator methodIL = method.GetILGenerator();
methodIL.Emit(OpCodes.Nop);
methodIL.Emit(OpCodes.Ldarg_0);
methodIL.Emit(OpCodes.Ldstr, "ID");
var indexerDictionary = typeof(Csla.Core.BusinessBase);
methodIL.Emit(OpCodes.Call, indexerDictionary.GetMethod("get_Item", new Type[] { typeof(string) }));
methodIL.Emit(OpCodes.Stloc_0);
methodIL.Emit(OpCodes.Br_S, "IL_000f");
methodIL.Emit(OpCodes.Ldloc_0);
methodIL.Emit(OpCodes.Ret);
一直不成功不知什么原因,请教大师们