GetHashCode() public static method

public static GetHashCode ( string name ) : int
name string
return int
示例#1
0
        public XmlName?GetName(string?prefix, string localName, string?ns, IXmlSchemaInfo?schemaInfo)
        {
            if (prefix == null)
            {
                prefix = string.Empty;
            }
            if (ns == null)
            {
                ns = string.Empty;
            }

            int hashCode = XmlName.GetHashCode(localName);

            for (XmlName e = _entries[hashCode & _mask]; e != null; e = e.next)
            {
                if (e.HashCode == hashCode &&
                    ((object)e.LocalName == (object)localName ||
                     e.LocalName.Equals(localName)) &&
                    ((object)e.Prefix == (object)prefix ||
                     e.Prefix.Equals(prefix)) &&
                    ((object)e.NamespaceURI == (object)ns ||
                     e.NamespaceURI.Equals(ns)) &&
                    e.Equals(schemaInfo))
                {
                    return(e);
                }
            }
            return(null);
        }
        public XmlName AddName(string prefix, string localName, string ns, IXmlSchemaInfo schemaInfo)
        {
            if (prefix == null)
            {
                prefix = string.Empty;
            }
            if (ns == null)
            {
                ns = string.Empty;
            }
            int hashCode = XmlName.GetHashCode(localName);

            for (XmlName name = this.entries[hashCode & this.mask]; name != null; name = name.next)
            {
                if ((((name.HashCode == hashCode) && ((name.LocalName == localName) || name.LocalName.Equals(localName))) && ((name.Prefix == prefix) || name.Prefix.Equals(prefix))) && (((name.NamespaceURI == ns) || name.NamespaceURI.Equals(ns)) && name.Equals(schemaInfo)))
                {
                    return(name);
                }
            }
            prefix    = this.nameTable.Add(prefix);
            localName = this.nameTable.Add(localName);
            ns        = this.nameTable.Add(ns);
            int     index = hashCode & this.mask;
            XmlName name2 = XmlName.Create(prefix, localName, ns, hashCode, this.ownerDocument, this.entries[index], schemaInfo);

            this.entries[index] = name2;
            if (this.count++ == this.mask)
            {
                this.Grow();
            }
            return(name2);
        }
示例#3
0
 public XmlAttribute this[string localName, string namespaceURI]
 {
     get
     {
         ArrayList nodes    = base.Nodes;
         int       hashCode = XmlName.GetHashCode(localName);
         for (int i = 0; i < nodes.Count; i++)
         {
             XmlAttribute attribute = (XmlAttribute)nodes[i];
             if (((hashCode == attribute.LocalNameHash) && (localName == attribute.LocalName)) && (namespaceURI == attribute.NamespaceURI))
             {
                 return(attribute);
             }
         }
         return(null);
     }
 }
示例#4
0
        public XmlName AddName(string?prefix, string localName, string?ns, IXmlSchemaInfo?schemaInfo)
        {
            if (prefix == null)
            {
                prefix = string.Empty;
            }
            if (ns == null)
            {
                ns = string.Empty;
            }

            int hashCode = XmlName.GetHashCode(localName);

            for (XmlName e = _entries[hashCode & _mask]; e != null; e = e.next)
            {
                if (e.HashCode == hashCode &&
                    ((object)e.LocalName == (object)localName ||
                     e.LocalName.Equals(localName)) &&
                    ((object)e.Prefix == (object)prefix ||
                     e.Prefix.Equals(prefix)) &&
                    ((object)e.NamespaceURI == (object)ns ||
                     e.NamespaceURI.Equals(ns)) &&
                    e.Equals(schemaInfo))
                {
                    return(e);
                }
            }

            prefix    = _nameTable.Add(prefix);
            localName = _nameTable.Add(localName);
            ns        = _nameTable.Add(ns);
            int     index = hashCode & _mask;
            XmlName name  = XmlName.Create(prefix, localName, ns, hashCode, _ownerDocument, _entries[index], schemaInfo);

            _entries[index] = name;

            if (_count++ == _mask)
            {
                Grow();
            }

            return(name);
        }
        public XmlAttribute this[string name]
        {
            get {
                int hash = XmlName.GetHashCode(name);

                for (int i = 0; i < nodes.Count; i++)
                {
                    XmlAttribute node = (XmlAttribute)nodes[i];

                    if (hash == node.LocalNameHash &&
                        name == node.Name)
                    {
                        return(node);
                    }
                }

                return(null);
            }
        }
        public XmlAttribute? this[string localName, string?namespaceURI]
        {
            get
            {
                int hash = XmlName.GetHashCode(localName);

                for (int i = 0; i < nodes.Count; i++)
                {
                    XmlAttribute node = (XmlAttribute)nodes[i];

                    if (hash == node.LocalNameHash &&
                        localName == node.LocalName &&
                        namespaceURI == node.NamespaceURI)
                    {
                        return(node);
                    }
                }

                return(null);
            }
        }
        public XmlName GetName(string prefix, string localName, string ns, IXmlSchemaInfo schemaInfo)
        {
            if (prefix == null)
            {
                prefix = string.Empty;
            }
            if (ns == null)
            {
                ns = string.Empty;
            }
            int hashCode = XmlName.GetHashCode(localName);

            for (XmlName name = this.entries[hashCode & this.mask]; name != null; name = name.next)
            {
                if ((((name.HashCode == hashCode) && ((name.LocalName == localName) || name.LocalName.Equals(localName))) && ((name.Prefix == prefix) || name.Prefix.Equals(prefix))) && (((name.NamespaceURI == ns) || name.NamespaceURI.Equals(ns)) && name.Equals(schemaInfo)))
                {
                    return(name);
                }
            }
            return(null);
        }