public static string GetSetting(this SiteMapNode node, string key, bool includingInheritedSettings) { if (node == null || node.ParentNode == null) { return(null); } var settings = node.GetSettings(); if (settings.ContainsKey(key)) { return(settings[key]); } else if (includingInheritedSettings) { return(GetSetting(node.ParentNode, key, includingInheritedSettings: true)); } else { return(null); } }