0

I asked this question earlier and that helped a lot. Then I realized I also need a list of IDs of the List that is a property in that object. Basically I want to end up with a list of integers generated from each list in those objects. Any ideas? Thanks!

1
  • 7
    Please make your question self-contained. Commented Aug 2, 2012 at 21:42

1 Answer 1

4
var ids = (from x in outerList
          from y in x.List
          select y).ToList();

Or to avoid dups:

var ids = (from x in outerList
          from y in x.List
          select y).Distinct().ToList();

For info, this could also be written:

var ids = outerList.SelectMany(x => x.List).ToList();

or:

var ids = outerList.SelectMany(x => x.List).Distinct().ToList();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.