A: 

How about something like the following, this allows me to register every implementation of the interface 'IAnimal' and then use 'ResolveAll' to get all implementations back as collection.

Hope it helps

Ollie

class Program
{
    static void Main(string[] args)
    {
        var container = new WindsorContainer();
        container.Register(AllTypes.Pick().FromAssembly(Assembly.GetExecutingAssembly()).AllowMultipleMatches());

        var dog = container.Resolve<Dog>();
        var animals = container.ResolveAll<IAnimal>();
    }
}

public interface IAnimal
{
}

public class Dog : IAnimal
{
}

public class Cat : IAnimal
{
}

public class Fish : IAnimal
{
}
AWC
+1  A: 

Easiest thing to do is implement a SubDependancyResolver to resolve arrays then pass in the type in a construtor.

taken from hammett blog

public class ArrayResolver : ISubDependencyResolver
{
    private readonly IKernel kernel;

    public ArrayResolver(IKernel kernel)
    {
          this.kernel = kernel;
    }

    public object Resolve(CreationContext context, ISubDependencyResolver parentResolver,
                          ComponentModel model,
                          DependencyModel dependency)
    {
         return kernel.ResolveAll(dependency.TargetType.GetElementType(), null);
    }

    public bool CanResolve(CreationContext context, ISubDependencyResolver parentResolver,
                          ComponentModel model,
                          DependencyModel dependency)
    {
          return dependency.TargetType != null &&
  dependency.TargetType.IsArray &&
  dependency.TargetType.GetElementType().IsInterface;
    }
}

public class AnimalManager
{
     private readonly IAnimal[] _animals;
     public AnimalManager(IAnimal[] animals)
     {
         _animals = animals
     }
}    

//Setup container somewhere
public IWindsorContainer ConfigureContainer()
{
     IWindsorContainer container = new WindsorContainer().Register(AllTypes.FromAssemblyContaining<Cat>());
     container.Kernel.Resolver.AddSubResolver(typeof(ArrayResolver));

     IAnimalManager manager = container.Resolve<AnimalManager>();
}

The container will now inject all the the animal types into the AnimalManager class for you to use.

Colin G

Colin G
ArrayResolver now comes included
Mauricio Scheffer
@mausch I did not know that cheers
Colin G
Appreciated you took the time to answer Colin thanks! Even nicer to know that it's even easier now ArrayResolver is included :)
Nick Meldrum
+1  A: 

See this question.

Mauricio Scheffer
Cheers Mausch :)
Nick Meldrum