예제 #1
0
        public static IEnumerable <HElement> Elements(this HContainer container, string name)
        {
            if (container.Children == null)
            {
                return(new HElement[0]);
            }

            return(container.Children.Where(c => c.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)));
        }
예제 #2
0
        public static IEnumerable <HElement> Descendants(this HContainer container, string name)
        {
            foreach (var element in container.Elements(name))
            {
                yield return(element);
            }

            foreach (var child in container.Children)
            {
                foreach (var element in child.Descendants(name))
                {
                    yield return(element);
                }
            }
        }