I'm still trying to get the hang of LINQ and am having trouble with this. I have a List<Data>
like so:
GroupId|SectionId|Content
-------------------------
1| 3|part1-2
1| 7|part1-1
3| 3|part3-2
1| 1|part1-3
3| 1|part3-3
3| 7|part3-1
I would like to convert it to IEnumerable<AnonymousType>
where each AnonymousType
represents one GroupId
and each property is linked to a specific SectionId
. In other words, you would end up with something like this:
{
{
GroupId = 1,
Part1 = "part1-1", // From SectionId == 7
Part2 = "part1-2", // From SectionId == 3
Part3 = "part1-3", // From SectionId == 1
},
{
GroupId = 3,
Part1 = "part3-1", // From SectionId == 7
Part2 = "part3-2", // From SectionId == 3
Part3 = "part3-3", // From SectionId == 1
}
}