public static bool HasPublicConstructor(this Type t) { IReflector r = Reflector.Bind(t, ReflectorPolicy.CreateInstance(false, false, false, false)); foreach (var ctor in r.FindAllConstructors()) { if (ctor.IsPublic) { return(true); } } return(false); }
public static bool HasDefaultConstructor(this Type t) { IReflector r = Reflector.Bind(t, ReflectorPolicy.CreateInstance(true, false, false, false)); foreach (var ctor in r.FindAllConstructors()) { if (ctor.GetParameters().Length == 0) { return(true); } } return(false); }