private bool MatchesParamArraySignature(ParameterInfo[] param0, ParameterInfo[] param1, int ParamArrayIndex1, bool IsPropertySet, int ArgCountUpperBound) { int upperBound = param0.GetUpperBound(0); if (IsPropertySet) { upperBound--; } upperBound = Math.Min(upperBound, ArgCountUpperBound); int num3 = upperBound; for (int i = 0; i <= num3; i++) { Type elementType; Type parameterType = param0[i].ParameterType; if (parameterType.IsByRef) { parameterType = parameterType.GetElementType(); } if (i >= ParamArrayIndex1) { elementType = param1[ParamArrayIndex1].ParameterType.GetElementType(); } else { elementType = param1[i].ParameterType; if (elementType.IsByRef) { elementType = elementType.GetElementType(); } } if (parameterType != elementType) { return false; } } return true; }
private BindScore BindingScore(ParameterInfo[] Parameters, int[] paramOrder, Type[] ArgTypes, bool IsPropertySet, int ParamArrayIndex) { BindScore exact = BindScore.Exact; int upperBound = ArgTypes.GetUpperBound(0); int num3 = Parameters.GetUpperBound(0); if (IsPropertySet) { num3--; upperBound--; } int num5 = Math.Max(upperBound, num3); for (int i = 0; i <= num5; i++) { int num; Type type; if (paramOrder == null) { num = i; } else { num = paramOrder[i]; } if (num == -1) { type = null; } else { type = ArgTypes[num]; } if (type != null) { Type parameterType; if (i > num3) { parameterType = Parameters[ParamArrayIndex].ParameterType; } else { parameterType = Parameters[i].ParameterType; } if (((i != ParamArrayIndex) || !type.IsArray) || (parameterType != type)) { if (((i == ParamArrayIndex) && type.IsArray) && (((this.m_state.m_OriginalArgs == null) || (this.m_state.m_OriginalArgs[num] == null)) || parameterType.IsInstanceOfType(this.m_state.m_OriginalArgs[num]))) { if (exact < BindScore.Widening1) { exact = BindScore.Widening1; } } else { if (((ParamArrayIndex != -1) && (i >= ParamArrayIndex)) || parameterType.IsByRef) { parameterType = parameterType.GetElementType(); } if (type != parameterType) { if (ObjectType.IsWideningConversion(type, parameterType)) { if (exact < BindScore.Widening1) { exact = BindScore.Widening1; } } else if (type.IsArray && (((this.m_state.m_OriginalArgs == null) || (this.m_state.m_OriginalArgs[num] == null)) || parameterType.IsInstanceOfType(this.m_state.m_OriginalArgs[num]))) { if (exact < BindScore.Widening1) { exact = BindScore.Widening1; } } else { exact = BindScore.Narrowing; } } } } } } return exact; }
private Exception CreateParamOrder(bool SetProp, int[] paramOrder, ParameterInfo[] pars, object[] args, string[] names) { int num; bool[] flagArray = new bool[(pars.Length - 1) + 1]; int num4 = (args.Length - names.Length) - 1; int upperBound = pars.GetUpperBound(0); int num5 = pars.GetUpperBound(0); for (num = 0; num <= num5; num++) { paramOrder[num] = -1; } if (SetProp) { paramOrder[pars.GetUpperBound(0)] = args.GetUpperBound(0); num4--; upperBound--; } int num6 = num4; for (num = 0; num <= num6; num++) { paramOrder[num] = names.Length + num; } int num7 = names.GetUpperBound(0); for (num = 0; num <= num7; num++) { int num8 = upperBound; int index = 0; while (index <= num8) { if (Strings.StrComp(names[num], pars[index].Name, CompareMethod.Text) == 0) { if (paramOrder[index] != -1) { return new ArgumentException(Utils.GetResourceString("NamedArgumentAlreadyUsed1", new string[] { pars[index].Name })); } paramOrder[index] = num; flagArray[num] = true; break; } index++; } if (index > upperBound) { return new MissingMemberException(Utils.GetResourceString("Argument_InvalidNamedArg2", new string[] { names[num], this.CalledMethodName() })); } } return null; }