I created a class for hierarchical data. From this class I generate custom treeview. Before sending data to treeview I need delete a branch that does not end with instance with HaveData = true
public class Data
{
public List<Data> Children
{
get;
set;
}
public bool HaveData
{
get;
set;
}
}
Treeview before:
1 First
1.1 Item
1.1.1 Item (HaveData = false)
1.2 Item
1.2.1 Item (HaveData = true)
...
I need:
1 First
1.2 Item
1.2.1 Item (HaveData = true)
...
How to go through all nodes and remove only those that ending HaveData = false?
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…