I m working with different inherited classes i want get this class names inherited from same interface

```
public class CollectorA : ICollector
{
    public string CollectSomething()
    {
        //DO Something
    }
}
public class CollectorB : ICollector
{
    public string CollectSomething()
    {
        //DO Something
    }
}

```

I want to do like :

```
public void Init(IServiceCollection serviceCollection)
{

    var types  = AppDomain.CurrentDomain.GetAssemblies()
                          .SelectMany(assembly => assembly.GetTypes())
                          .Where(type => type.IsInstanceOfType(typeof(ICollector))); 

```

Getting types returns null I tried AppContext but still not works.

```
foreach(var item in types)
{
    serviceCollection.AddTransient<ICollector,item.Name>();
} 

```