views:

182

answers:

1

Hi,

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

Thanks

+6  A: 

Use IKernel.GetAssignableHandlers(typeof(object)):

IWindsorContainer container = ...

foreach (var handler in container.Kernel.GetAssignableHandlers(typeof(object))) {
    Console.WriteLine("{0} {1}", 
       handler.ComponentModel.Service, 
       handler.ComponentModel.Implementation);
}
Mauricio Scheffer
Added to the Windsor FAQ: http://using.castleproject.org/display/IoC/FAQ
Mauricio Scheffer