I was wondering whether someone may be able to help.
I have a text file with lines into that I have split on \t. They have two columns, a code and a name.
I was hoping to split this one dimensional structure into a parent child hierarchy on the code column.
Example of data being:
0100000000 Coffee
0110000000 Mocha
0120000000 Cappuccino
0121000000 Semi skimmed
0121100000 Starbuckz
0121200000 Costa
0122000000 Skimmed
0130000000 Latte
Human readable hierarchy:
0100000000 Coffee
0110000000 Mocha
0120000000 Cappuccino
0121000000 Semi skimmed
0121100000 Starbuckz
0121200000 Costa
0122000000 Skimmed
0130000000 Latte
I would like to convert this structure into a format like:
public class LineData
{
public string OriginalCode { get; set; }
public string Title { get; set; }
public LineData Parent { get; set; }
public List<LineData> Children { get; set; }
}
The list is static and I will probably end up just storing in memory.