递归获取所有子孙节点
private void GetCategoryTreeNodes(List<FormTemplateCategory> allList,string rowGuid,ref List<FormTemplateCategory> treeNodes) { if (allList == null) return; List<FormTemplateCategory> subList; subList = allList.Where(p => p.ParentRowGuid == rowGuid).ToList(); if (!subList.Any()) return; foreach(FormTemplateCategory item in subList) { treeNodes.Add(item); GetCategoryTreeNodes(allList, item.RowGuid, ref treeNodes); } }