Get all types implementing specific open generic type
This will return all types that inherit a generic base class. Not all types that inherit a generic interface. var AllTypesOfIRepository = from x in Assembly.GetAssembly(typeof(AnyTypeInTargetAssembly)).GetTypes() let y = x.BaseType where !x.IsAbstract && !x.IsInterface && y != null && y.IsGenericType && y.GetGenericTypeDefinition() == typeof(IRepository<>) select x; This will return all types, including interfaces, abstracts, and … Read more