private static IEnumerable<Type> SelfAndBaseTypes(Type type) { if (type.IsInterface) { var types = new HashSet<Type>(); AddInterface(types, type); return types; } return SelfAndBaseClasses(type); }