public void ConfigureDependencies(IServiceCollection serviceCollection) { foreach (System.Type registry in GetTypesForSearchRegistries()) { IEnumerable <System.Type> interfaces = ((System.Reflection.TypeInfo)registry).ImplementedInterfaces; if (interfaces.Any(i => i == typeof(IDependencyRegister))) { IDependencyRegister dependecy = (IDependencyRegister)Activator.CreateInstance(registry); dependecy.ConfigureDependencies(serviceCollection); } } }