public Type MakeDelegateType(Type retType, IList <Expression> args) { Type[] types = new Type[args.Count + 2]; types[0] = typeof(CallSite); types[types.Length - 1] = retType; for (int i = 0; i < args.Count; i++) { types[i + 1] = args[i].Type; } return(this.DelegateType = DelegateHelpers.MakeNewDelegate(types)); }
public static Type MakeDelegateType(this DelegateHelpers.TypeInfo info, Type retType, IList <Expression> args) { // nope, go ahead and create it and spend the // cost of creating the array. Type[] paramTypes = new Type[args.Count + 2]; paramTypes[0] = typeof(CallSite); paramTypes[paramTypes.Length - 1] = retType; for (int i = 0; i < args.Count; i++) { paramTypes[i + 1] = args[i].Type; } return(info.DelegateType = DelegateHelpers.MakeNewDelegate(paramTypes)); }