Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

Extensions.cs

namespace Nop.Web.Framework.Menu;

/// 
/// Extensions
/// 
public static class Extensions
{
    /// 
    /// Checks whether this node or child ones has a specified system name
    /// 
    /// Node
    /// System name
    /// Result
    public static bool ContainsSystemName(this SiteMapNode node, string systemName)
    {
        ArgumentNullException.ThrowIfNull(node);

        if (string.IsNullOrWhiteSpace(systemName))
            return false;

        if (systemName.Equals(node.SystemName, StringComparison.InvariantCultureIgnoreCase))
            return true;

        return node.ChildNodes.Any(cn => ContainsSystemName(cn, systemName));
    }
}