List all types registered with a Castle Windsor container instance

Viewed 5876

What's the easiest way of programatically listing registered types in Castle Windsor?

Thanks

2 Answers

Further to Mauricio's excellent answer, if handler.ComponentModel.Service cannot be found use this instead:

IWindsorContainer container = ...

foreach (var handler in container.Kernel.GetAssignableHandlers(typeof(object))) {
    Console.WriteLine("{0} {1}", 
       String.Join(",", handler.ComponentModel.Services), 
       handler.ComponentModel.Implementation);
}
Related