Mvp.Xml.Common.XPath.XPathNavigatorIterator.ContainsValue C# (CSharp) Méthode

ContainsValue() public méthode

Determines whether the list contains a navigator whose Value property matches the target value
public ContainsValue ( string value ) : bool
value string The value to locate in the list.
Résultat bool
        public bool ContainsValue(string value)
        {
            foreach (XPathNavigator nav in _navigators)
            {
                if (nav.Value.Equals(value))
                {
                    return true;
                }
            }
            return false;
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Implements the following function 
        ///    node-set distinct(node-set)
        /// </summary>
        /// <param name="nodeset">The input nodeset</param>
        /// <returns>Returns the nodes in the nodeset whose string value is 
        /// distinct</returns>
        public XPathNodeIterator distinct(XPathNodeIterator nodeset)
        {
            if (nodeset.Count > 15)
                return distinct2(nodeset);
            //else
            XPathNavigatorIterator nodelist = new XPathNavigatorIterator();

            while (nodeset.MoveNext())
            {
                if (!nodelist.ContainsValue(nodeset.Current.Value))
                {
                    nodelist.Add(nodeset.Current.Clone());
                }
            }
            nodelist.Reset();
            return nodelist;

        }