public static ActivatorDelegate <T> CreateActivator <T>(this ConstructorInfo constructor) { if (!typeof(T).IsAssignableFrom(constructor.DeclaringType)) { throw new TypeMismatchException(typeof(T), constructor.DeclaringType); } return(constructor.CreateActivator().Cast <T>()); }