private ServiceDefinition FindManyEnumerable(Type serviceType)
        {
            if (_linkedServiceDefinitions.TryGetValue(serviceType, out var value))
            {
                return(value.Last.Value);
            }
            var elementType = serviceType.GetTypeInfo().GetGenericArguments()[0];
            var elements    = FindEnumerableElements(serviceType);
            var enumerableServiceDefinition = new ManyEnumerableServiceDefintion(serviceType, elementType, elements);

            _linkedServiceDefinitions[serviceType] = new LinkedList <ServiceDefinition>(new ServiceDefinition[] { enumerableServiceDefinition });
            return(enumerableServiceDefinition);
        }
        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);
            });
        }