-
-
Save toburger/5204998 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
namespace Intranet | |
{ | |
public static class MenuExtensions | |
{ | |
public static IMenu NextSibling(this IMenu menu) | |
{ | |
if (menu.Parent == null) | |
throw new InvalidOperationException("I'm the root menu node, I have no parents!"); | |
return (from n in menu.Parent.Nodes | |
where n.Order >= menu.Order | |
orderby n.Order | |
select n).FirstOrDefault(); | |
} | |
public static IMenu NextParent(this IMenu menu) | |
{ | |
return menu.Parent.NextSibling(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment