/// <summary> /// 获取所有后继兄弟节点 /// </summary> /// <returns></returns> protected virtual IList <T> GetNextSiblingNodes() { if (SiblingNodes != null) { IEnumerable <T> nsibs = SiblingNodes.Where(tent => tent.SortIndex > this.SortIndex); if (nsibs.Count() > 0) { return(nsibs.ToList()); } } return(null); }
/// <summary> /// 获取后继兄弟节点 /// </summary> /// <returns></returns> protected virtual T GetNextSibling() { if (SiblingNodes != null) { IEnumerable <T> psibs = SiblingNodes.Where(tent => tent.SortIndex > this.SortIndex); if (psibs.Count() > 0) { // 从小到大排序的第一个 return(psibs.OrderBy(tent => tent.SortIndex).First()); } return(null); } return(null); }
/// <summary> /// 获取前置兄弟节点 /// </summary> /// <returns></returns> protected virtual T GetPrevSibling() { if (SiblingNodes != null) { IEnumerable <T> psibs = SiblingNodes.Where(tent => tent.SortIndex < this.SortIndex); if (psibs.Count() > 0) { // 从大到小排序的第一个 return(psibs.OrderByDescending(tent => tent.SortIndex).First()); } return(null); } return(null); }