//递归获取子节点 public static IList <XTreeObject> GetDatas(XTreeObject node, List <XTreeObject> childrensTreeObject) { IList <XTreeObject> childrens = childrensTreeObject.Where(it => node.value == it.pId).Select(x => new XTreeObject { value = x.value, title = x.title, pId = x.pId, @checked = x.@checked }).ToList(); foreach (XTreeObject item in childrens) { item.data = GetDatas(item, childrensTreeObject); } return(childrens); }
public virtual void Addchildren(XTreeObject node) { this.data.Add(node); }