I want to generate a tree view using text file in c#. But I am unable to apply the concept. Would you please tell me how to do it? The txt file contains the following: Separately separated:
Separator =( , ) Parents =Capital letters. Child =Lowercase letters.
A , a, b, c
B, d, e, f
C, g, h, q
CodePudding user response:
Pseudo code would look like this
foreach line in fileLines
{
lineNodes = line.Split(", ")
newParentNode = tree.Nodes.Add(new Node(lineNodes[0]))
newParentNode.Children.Add(new Node(lineNodes[1]))
newParentNode.Children.Add(new Node(lineNodes[2]))
newParentNode.Children.Add(new Node(lineNodes[3]))
}
Now, you can use c# specific syntax to implement your home work