internal DynamicILGen CreateDynamicMethod(string methodName, Type returnType, Type[] parameterTypes, bool isDebuggable) { ContractUtils.RequiresNotEmpty(methodName, "methodName"); ContractUtils.RequiresNotNull(returnType, "returnType"); ContractUtils.RequiresNotNullItems(parameterTypes, "parameterTypes"); if (_saveSnippets) { AssemblyGen assembly = GetAssembly(isDebuggable, false); TypeBuilder tb = assembly.DefinePublicType(methodName, typeof(object), false); MethodBuilder mb = tb.DefineMethod(methodName, TypeUtils.PublicStatic, returnType, parameterTypes); return(new DynamicILGenType(tb, mb, mb.GetILGenerator())); } else { DynamicMethod dm = Helpers.CreateDynamicMethod(methodName, returnType, parameterTypes); return(new DynamicILGenMethod(dm, dm.GetILGenerator())); } }
internal TypeBuilder DefineType(string name, Type parent, bool preserveName, bool isUnsafe, bool emitDebugSymbols) { AssemblyGen ag = GetAssembly(emitDebugSymbols, isUnsafe); return(ag.DefinePublicType(name, parent, preserveName)); }