Home > Net >  LIST a directory tree layer
LIST a directory tree layer

Time:09-24

Big brand I childid before and the Parent as the number of layers,
Childid and change the Parent character now and don't know how to have a layered.
Childid and potential for the Parent letter or symbol, is unknown.
Still hope again grant instruction!
Thank you very much!

Model is as follows:

Public class ResList
{
Public int ID {get; set; }
Public string childid {get; set; }
Public ListPublic string Parent {get; set; }
Public int Rank
{
The get
{
Return path. The Split (', '). The Length;
}
}

Internal string path {get; set; }=string. The Empty;
}


List Alllist=new List (a);//raw data
Alllist. Add (new ResList {ID=1, childid="E1", the Parent="E0"});
Alllist. Add (new ResList {ID=2, childid="E2", the Parent="E1"});
Alllist. Add (new ResList {ID=3, childid="E3", the Parent="E2"});
Alllist. Add (new ResList {ID=4, childid="E4", the Parent="E3"});
Alllist. Add (new ResList {ID=5, childid="E5," Parent "=" E1 "});
Alllist. Add (new ResList {ID=6, childid="E6", the Parent="E0"});
Alllist. Add (new ResList {ID=7, childid="E7", the Parent="E5}");
Alllist. Add (new ResList {ID=8, childid="E8", the Parent="E7}");
Alllist. Add (new ResList {ID=9, childid="E9", the Parent="E6"});
Alllist. Add (new ResList {ID=10, childid="E10," Parent "=" E6 "});
Alllist. Add (new ResList {ID=11, childid=E11, Parent="E8}");
Alllist. Add (new ResList {ID=12, childid="E12 at 11:45.", the Parent=E11});
Alllist. Add (new ResList {ID=13, childid="E13", the Parent="E12 at 11:45."});
Alllist. Add (new ResList {ID=14, childid="E14," Parent=E11});
Alllist. Add (new ResList {ID=15, childid="E15," Parent "=" E14} ");
Alllist. Add (new ResList {ID=16, childid="E16," Parent "=" E13} ");
Alllist. Add (new ResList {ID=17, childid="E15," Parent "=" E9} ");
Alllist. Add (new ResList {ID=18, childid="E16," Parent "=" E8} ");



Still hope for the Rank among the top the list with hierarchical tag.

Digital layered results as follows:

https://img-bbs.csdn.net/upload/202001/03/1578021996_844999.png

CodePudding user response:

I really want to come back in another thread,
  •  Tags:  
  • C#
  • Related