I am trying to find a constructor with a specific signature. This constructor does not exist in the current type, but it has in its parent. To illustrate:
public class Base { public Base() { } public Base(string a1, string a2, string a3) { ... } } public class Child : Base { }
The problem is that I cannot find .ctor with string arguments using .GetConstructor , I even try, for example:
typeof(Child).GetConstructor(BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(string), typeof(string), typeof(string) }, null);
replacing typeof(Child) with typeof(Base) naturally works.
Is there something I am missing in finding parent constructors?
source share