Assume we have some denormalized data, like this:
List<string[]> dataSource = new List<string[]>();
string [] row1 = {"grandParentTitle1", "parentTitle1", "childTitle1"};
string [] row2 = {"grandParentTitle1", "parentTitle1", "childTitle2"};
string [] row3 = {"grandParentTitle1", "parentTitle2", "childTitle3"};
string [] row4 = {"grandParentTitle1", "parentTitle2", "childTitle4"};
dataSource.Add(row1);
I need to normalize it, e.g. to get IEnumerable< Child > with Child.Parent and Child.Parent.GrandParent filled.
Imperative way is more or less clear. Will it be shorter with Linq?
Better in one query, and this should be expandable for more entities.
I tried something like separately create IEnumerable< GrandParent >, then IEnumerable< Parent > with assigning etc.
PLease make a hint could this be achieved in a functional way?