public GetConstructor ( BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type types, ParameterModifier modifiers ) : ConstructorInfo | ||
bindingAttr | BindingFlags | A bitmask comprised of one or more |
binder | Binder | An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.-or- A null reference (Nothing in Visual Basic), to use the |
callConvention | CallingConventions | The object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and the stack is cleaned up. |
types | Type | An array of |
modifiers | ParameterModifier | An array of |
return | ConstructorInfo |
public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
{
if (types == null)
throw new ArgumentNullException("types");
for (int index = 0; index < types.Length; ++index)
{
if (types[index] == (Type)null)
throw new ArgumentNullException("types");
}
return this.GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers);
}
Type::GetConstructor ( BindingFlags bindingAttr, Binder binder, Type types, ParameterModifier modifiers ) : ConstructorInfo | |
Type::GetConstructor ( Type types ) : ConstructorInfo |
/// <summary> /// Создает на основе типа фильтр /// </summary> /// <param name="lib"></param> /// <param name="type"></param> public Filter(string lib, Type type) { libname = lib; if (type.BaseType == typeof(AbstractFilter)) { Exception fullex = new Exception(""); ConstructorInfo ci = type.GetConstructor(System.Type.EmptyTypes); filter = ci.Invoke(null); PropertyInfo everyprop; everyprop = type.GetProperty("Name"); name = (string)everyprop.GetValue(filter, null); everyprop = type.GetProperty("Author"); author = (string)everyprop.GetValue(filter, null); everyprop = type.GetProperty("Ver"); version = (Version)everyprop.GetValue(filter, null); help = type.GetMethod("Help"); MethodInfo[] methods = type.GetMethods(); filtrations = new List<Filtration>(); foreach (MethodInfo mi in methods) if (mi.Name == "Filter") { try { filtrations.Add(new Filtration(mi)); } catch (TypeLoadException) { //Не добавляем фильтрацию. } } if (filtrations == null) throw new TypeIncorrectException("Класс " + name + " не содержит ни одной фильтрации"); } else throw new TypeLoadException("Класс " + type.Name + " не наследует AbstractFilter"); }