private Func <ServiceResolver, object> ResolveManyEnumerableService(ManyEnumerableServiceDefintion manyEnumerableServiceDefintion) { var elementDefinitions = manyEnumerableServiceDefintion.ServiceDefinitions.ToArray(); var elementType = manyEnumerableServiceDefintion.ElementType; return(resolver => { var length = elementDefinitions.Length; var instance = Array.CreateInstance(elementType, length); for (var i = 0; i < length; i++) { instance.SetValue(resolver.ResolveDefinition(elementDefinitions[i]), i); } return ActivatorUtils.CreateManyEnumerable(elementType, instance); }); }