BuildIt.Autofac.AutofacServiceLocator.DoGetAllInstances C# (CSharp) Method

DoGetAllInstances() protected method

Resolves all requested service instances.
/// Thrown if is . ///
protected DoGetAllInstances ( Type serviceType ) : IEnumerable
serviceType System.Type Type of instance requested.
return IEnumerable
        protected override IEnumerable<object> DoGetAllInstances(Type serviceType)
        {
            if (serviceType == null)
            {
                throw new ArgumentNullException("serviceType");
            }
            var enumerableType = typeof(IEnumerable<>).MakeGenericType(serviceType);

            object instance = container.Resolve(enumerableType);
            return ((IEnumerable)instance).Cast<object>();
        }
    }