1

i have this list in C#:

enter image description here

and i wanna divide it to 4 list like this :

enter image description here

how can i do this with Linq?

1
  • So something like this example? Commented Sep 23, 2016 at 12:25

1 Answer 1

2

You want to group by Field1, so use Enumerable.GroupBy:

var field1GroupLists = mainList
    .GroupBy(x => x.Field1)
    .Select(group => group.ToList())
    .ToList();
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.