protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
Binder binder,
CallingConventions callConvention,
Type[] types,
ParameterModifier[] modifiers)
{
if (bindingAttr == BindingFlags.Default)
bindingAttr = BindingFlags.Public | BindingFlags.Instance;
ConstructorInfo[] methods = GetConstructors (bindingAttr);
ConstructorInfo found = null;
MethodBase[] match;
int count = 0;
foreach (ConstructorInfo m in methods) {
// Under MS.NET, Standard|HasThis matches Standard...
if (callConvention != CallingConventions.Any && ((m.CallingConvention & callConvention) != callConvention))
continue;
found = m;
count++;
}
if (count == 0)
return null;
if (types == null) {
if (count > 1)
throw new AmbiguousMatchException ();
return (ConstructorInfo) CheckMethodSecurity (found);
}
match = new MethodBase [count];
if (count == 1)
match [0] = found;
else {
count = 0;
foreach (ConstructorInfo m in methods) {
if (callConvention != CallingConventions.Any && ((m.CallingConvention & callConvention) != callConvention))
continue;
match [count++] = m;
}
}
if (binder == null)
binder = Binder.DefaultBinder;
return (ConstructorInfo) CheckMethodSecurity (binder.SelectMethod (bindingAttr, match, types, modifiers));
}