Answer the question
In order to leave comments, you need to log in
How to use reflection to get interfaces by base C# interface
There was a task in which it is necessary to receive all interfaces on the base interface. For classes, the following code works
var types = assembly.GetTypes().Where(item => item.BaseType == typeof(BaseEntity));
Answer the question
In order to leave comments, you need to log in
Thanks to the post above, I got this code
var types = assembly.GetTypes().Where(item => item.GetInterfaces().Contains(typeof(IDependency)) && item.IsInterface);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question