Пример #1
0
            public int GetHashCode(IXmlIdentity name)
            {
                var code = NameComparer.GetHashCode(name.Name.LocalName);

                if (name.XsiType != XmlName.Empty)
                {
                    code = (code << 7 | code >> 25) ^ XsiTypeComparer.GetHashCode(name.XsiType);
                }

                // DO NOT include NamespaceUri in hash code.
                // That would break 'null means any' behavior.

                return(code);
            }
Пример #2
0
            public bool Equals(IXmlIdentity x, IXmlIdentity y)
            {
                var nameX = x.Name;
                var nameY = y.Name;

                if (!NameComparer.Equals(nameX.LocalName, nameY.LocalName))
                {
                    return(false);
                }

                if (!XsiTypeComparer.Equals(x.XsiType, y.XsiType))
                {
                    return(false);
                }

                return(nameX.NamespaceUri == null ||
                       nameY.NamespaceUri == null ||
                       NameComparer.Equals(nameX.NamespaceUri, nameY.NamespaceUri));
            }