private ServiceDefinition FindEnumerable(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 EnumerableServiceDefintion(serviceType, elementType, elements);

            _linkedServiceDefinitions[serviceType] = new LinkedList <ServiceDefinition>(new ServiceDefinition[] { enumerableServiceDefinition });
            return(enumerableServiceDefinition);
        }
        private Func <ServiceResolver, object> ResolveEnumerableService(EnumerableServiceDefintion enumerableServiceDefintion)
        {
            var elementDefinitions = enumerableServiceDefintion.ServiceDefinitions.ToArray();
            var elementType        = enumerableServiceDefintion.ElementType;

            return(resolver =>
            {
                var length = elementDefinitions.Length;
                var instance = Array.CreateInstance(elementType, length);
                for (var i = 0; i < length; i++)
                {
                    var element = resolver.ResolveDefinition(elementDefinitions[i]);
                    instance.SetValue(element, i);
                }
                return instance;
            });
        }