internal static object[] ConstructCallArguments(Symbols.Method TargetProcedure, object[] Arguments, BindingFlags LookupFlags) { ParameterInfo[] parameters = GetCallTarget(TargetProcedure, LookupFlags).GetParameters(); object[] matchedArguments = new object[(parameters.Length - 1) + 1]; int length = Arguments.Length; object argument = null; if (Symbols.HasFlag(LookupFlags, BindingFlags.SetProperty)) { object[] sourceArray = Arguments; Arguments = new object[(length - 2) + 1]; Array.Copy(sourceArray, Arguments, Arguments.Length); argument = sourceArray[length - 1]; } OverloadResolution.MatchArguments(TargetProcedure, Arguments, matchedArguments); if (Symbols.HasFlag(LookupFlags, BindingFlags.SetProperty)) { ParameterInfo parameter = parameters[parameters.Length - 1]; matchedArguments[parameters.Length - 1] = OverloadResolution.PassToParameter(argument, parameter, parameter.ParameterType); } return(matchedArguments); }