You have one generic list of type<T>. Each T in turn contains two generic lists of type<A> and type<B>. A and B implement interface I. A method exists which requires a generic list of type<I>. From the parent list of type<T>, how do you feed the method its required list of <I>?
List<I> il = new List<I>();
topList.Select(x => x.ListOfA).ToList().ForEach(x => x.ForEach(y=>il.Add((I)y)));
topList.Select(x => x.ListOfB).ToList().ForEach(x => x.ForEach(y=>il.Add((I)y)));
Result r = SomeMethod(il);
Is there a way to implement this by re-casting the objects in listofA and listofB to I without using a ForEach() call?
Can both lists be combined into one using a single line of code instead of two?
Is it necessary to instantiate il before proceeding?
The above code actually does work. It worked on the first try, even! And I am genuinely curious about the questions. S'my site, I'll talk about what I want! :)