What's the easiest way of programatically listing registered types in Castle Windsor?
Thanks
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);
}
来源:https://stackoverflow.com/questions/1550190/list-all-types-registered-with-a-castle-windsor-container-instance