public override void ReorderArgumentArray(ref Object[] args, Object state)
{
BinderState binderState = (BinderState)state;
ReorderParams(binderState.m_argsMap, args);
if (binderState.m_isParamArray) {
int paramArrayPos = args.Length - 1;
if (args.Length == binderState.m_originalSize)
args[paramArrayPos] = ((Object[])args[paramArrayPos])[0];
else {
// must be args.Length < state.originalSize
Object[] newArgs = new Object[args.Length];
Array.Copy(args, 0, newArgs, 0, paramArrayPos);
for (int i = paramArrayPos, j = 0; i < newArgs.Length; i++, j++) {
newArgs[i] = ((Object[])args[paramArrayPos])[j];
}
args = newArgs;
}
}
else {
if (args.Length > binderState.m_originalSize) {
Object[] newArgs = new Object[binderState.m_originalSize];
Array.Copy(args, 0, newArgs, 0, binderState.m_originalSize);
args = newArgs;
}
}
}