related to Getting all types that implement an interface we can easily get all Types in the Assembly that implements a specific interface.
Example:
interface IFace
{
}
class Face : IFace
{
}
class TwoFace : Face
{
}
For this structure, we will find both classes via reflection, i.e. all classes that are derived from the first implementation too, using
GetTypes().Where(
type => type.GetInterfaces().Contains(typeof(IFace))
)
So the question is: how can I restrict the result to the base class that initially implements the interface?! In this example: only class type Face is relevant.