private static Type[] GetLeafInterfaces(IServiceConfigurator <T> configurator) { var interfaces = configurator.GetType().GetInterfaces(); var parents = interfaces.SelectMany(i => i.GetInterfaces()); return(interfaces.Except(parents).ToArray()); }