/// <summary> /// Get successor or predecessor of this folder at the same level of the folders hierarchy /// </summary> /// <param name="backwards"> /// <see langword="true"/> for predecessor /// <see langword="false"/> for successor /// </param> /// <returns> /// <see langword="null"/> if none exist /// </returns> public IDataFolder GetNextSiblingInTree(bool backwards) { Check.RequireLambda(!IsVirtualRoot, () => new InvalidOperationException(StorageResources.VirtualRootInvalidOperation)); IDataFolder retval = ParentDataFolder.GetNextChild(this, backwards); if (null == retval) { if (!ParentDataFolder.IsVirtualRoot) { for ( IDataFolder nst = ParentDataFolder.GetNextSiblingInTree(backwards); nst != null && retval == null; nst = nst.GetNextSiblingInTree(backwards)) { retval = nst.GetFirstChildFolder(backwards); } } } return(retval); }