I am writing a lambda expression to get all types of classes, which are implemented some specific interface types, from AppDomain.CurrentDomain.GetAssemblies(). I am using the below Lambda expression to find the result. But the problem is, I am getting a Collection of array like IEnumerable<Type[]>. But I need it like just IEnumberable. How do I flatten the this result.
var types = AppDomain.CurrentDomain.GetAssemblies().Where(t => t.GetType().GetInterfaces()
.Any(type => type.IsGenericType && type.GetGenericTypeDefinition() == typeof (IMyInterface<,>)))
.SelectMany(a => a.GetTypes());