/// <summary> /// Creates an instance with a parameterized constructor. /// </summary> /// <param name="type">The type</param> /// <param name="constructor">The constructor info</param> /// <param name="parameters">The parameters to inject</param> /// <returns>The instance created</returns> public object CreateInstanceWithParameterizedConstructor(Type type, ConstructorInfo constructor, object[] parameters) { if (this.ParameterizedFactoryCache.TryGetValue(type, out Func <object[], object> factory)) { return(factory(parameters)); } else { factory = DelegateFactory.CreateParameterizedConstructor <object>(type, constructor); ParameterizedFactoryCache[type] = factory; return(factory(parameters)); } }