static private DuplicateParameterBinding ( object p0 ) : |
||
p0 | object | |
return |
public static void ValidateParameterBindings(MethodBase method, ParameterInfo[] parameters, ReadOnlyCollection <ParameterAssignment> argList, bool extensionMethod = false) { var boundParameters = new HashSet <ParameterInfo>(); if (extensionMethod) { boundParameters.Add(parameters[0]); } foreach (var arg in argList) { var parameter = arg.Parameter; var member = parameter.Member; var property = member as PropertyInfo; if (property != null) { // NB: This supports get access via indexers. member = property.GetGetMethod(true); } if (member != method) { throw Error.ParameterNotDefinedForMethod(parameter.Name, method.Name); } if (!boundParameters.Add(parameter)) { throw Error.DuplicateParameterBinding(parameter.Name); } } foreach (var parameter in parameters) { if (!boundParameters.Contains(parameter) && (!parameter.IsOptional || !parameter.HasDefaultValue)) { throw Error.UnboundParameter(parameter.Name); } } }