Reputation: 2613
If a query returns IEnumerable, how can I make it flat and have all the T from the arrays in a single IEnumerable?
var types = from genericType in subscriber.GetType().GetInterfaces()
where genericType.IsGenericType
&& genericType.GetGenericTypeDefinition() == typeof (ISubscriber<>)
select genericType.GetGenericArguments();
Upvotes: 0
Views: 71
Reputation: 8111
You can use SelectMany
method from Linq
:
var flat = types.SelectMany(x => x);
Upvotes: 6