标签:
List<E_Department> totalItems = (List<E_Department>)B_Department.Instance.Get_DepartmentList(slr); Action<E_Department> SetChildren = null; //封装一个方法(递归)不断读取树的分支 SetChildren = Parent => { Parent.Children = totalItems.FindAll(childItem => childItem.ParentGuid == Parent.Guid); Parent.Children.ForEach(SetChildren); }; //初始化树列表 List<E_Department> treeItems = totalItems.FindAll(parentItem => parentItem.ParentGuid == ""); treeItems.ForEach(SetChildren); return treeItems;
标签:
原文地址:http://www.cnblogs.com/wzk153/p/4353154.html