Using reflection, How can I get all types that implement some specific interface in .NET Core? I have noticed that the methods usable in .NET 4.6 are not available anymore.
For example, this code doesn't work.
var type = typeof(IMyInterface);
var types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => type.IsAssignableFrom(p));
It throws The name 'AppDomain' does not exist in the current context
error.
Aucun commentaire:
Enregistrer un commentaire