I have an
EntitySet<IEnumerable<T>>
returning from some query and need to cast it to
IEnumerable<T>.
Can I do it?
I have an
EntitySet<IEnumerable<T>>
returning from some query and need to cast it to
IEnumerable<T>.
Can I do it?
EntitySet<IEnumerable<T>>
implements IEnumerable<IEnumerable<T>>
. So you can do this:
IEnumerable<T> flattenedList = entitySet.SelectMany(e => e);
Looks a little strange, but SelectMany
takes a function that gets a "child list" from each item on a list and then concatenates all the child lists together into a single list. In this case, each item on the list is a list, so the lambda is nice and short.