/// <summary> /// Returns sitemap items from the provided <paramref name="node"/> depending on specified max level of navigation items. /// </summary> /// <typeparam name="T">Type of sitemap nodes to return.</typeparam> /// <param name="node">The navigation node.</param> /// <param name="maxLevel">The max level of navigation items.</param> /// <returns>Sitemap items if <paramref name="node"/> level is less than specified max level, otherwise empty sequence.</returns> public static IEnumerable <T> GetSitemapItems <T>(this INavigationNode node, int maxLevel) where T : class, INavigationNode => (node?.Level ?? int.MaxValue) < maxLevel?node.GetSitemapItems <T>() : Enumerable.Empty <T>();