Suppose we have some denormalized data, for example:
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, for example. to get an IEnumerable <Child> with Child.Parent and Child.Parent.GrandParent filled.
The imperative method is more or less clear. Will Linq be shorter?
Better in one request, and this should expand for more objects.
I tried something like separately creating an IEnumerable <GrandParent>, then an IEnumerable <Parent> with an assignment, etc.
PLease to make a hint, can this be achieved in a functional way?
linq normalization
rudnev
source share