示例#1
0
        /// <summary>
        /// Get the last <see cref="XmlElement"/> of the <see cref="XmlNodeList"/>
        /// </summary>
        /// <param name="nodeList"></param>
        /// <returns></returns>
        static public XmlElement LastElement(this XmlNodeList nodeList)
        {
            foreach (XmlElement item in nodeList.EnumerableElementReverse())
            {
                return(item);
            }

            return(null);
        }
示例#2
0
        /// <summary>
        /// Get the last the <see cref="XmlElement"/> with the corresponding name and and with the corresponding value attribute of the <see cref="XmlNodeList"/>
        /// </summary>
        /// <param name="nodeList"></param>
        /// <param name="name"></param>
        /// <param name="attribute"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        static public XmlElement LastElement(this XmlNodeList nodeList, string name, string attribute, string value)
        {
            foreach (XmlElement item in nodeList.EnumerableElementReverse())
            {
                if (item.Name == name && item.GetAttribute(attribute) == value)
                {
                    return(item);
                }
            }

            return(null);
        }
示例#3
0
        /// <summary>
        /// Get the last the <see cref="XmlElement"/> with the corresponding name of the <see cref="XmlNodeList"/>
        /// </summary>
        /// <param name="nodeList"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        static public XmlElement LastElement(this XmlNodeList nodeList, string name)
        {
            foreach (XmlElement item in nodeList.EnumerableElementReverse())
            {
                if (item.Name == name)
                {
                    return(item);
                }
            }

            return(null);
        }