MS.Internal.Xml.Cache.XPathNodeInfoAtom.GetHashCode C# (CSharp) Метод

GetHashCode() публичный Метод

Return this information atom's hash code, previously computed for performance.
public GetHashCode ( ) : int
Результат int
        public override int GetHashCode() {
            if (this.hashCode == 0) {
                int hashCode;

                // Start with local name
                hashCode = this.localNameHash;

                // Add page indexes
                if (this.pageSibling != null)
                    hashCode += (hashCode << 7) ^ this.pageSibling[0].PageInfo.PageNumber;

                if (this.pageParent != null)
                    hashCode += (hashCode << 7) ^ this.pageParent[0].PageInfo.PageNumber;

                if (this.pageSimilar != null)
                    hashCode += (hashCode << 7) ^ this.pageSimilar[0].PageInfo.PageNumber;

                // Save hashcode.  Don't save 0, so that it won't ever be recomputed.
                this.hashCode = ((hashCode == 0) ? 1 : hashCode);
            }

            return this.hashCode;
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Return true if this InfoAtom has the same values as another InfoAtom.
        /// </summary>
        public override bool Equals(object other)
        {
            XPathNodeInfoAtom that = other as XPathNodeInfoAtom;

            Debug.Assert(that != null);
            Debug.Assert((object)this.doc == (object)that.doc);
            Debug.Assert(this.pageInfo == null);

            // Assume that name parts are atomized
            if (this.GetHashCode() == that.GetHashCode())
            {
                if ((object)this.localName == (object)that.localName &&
                    (object)this.pageSibling == (object)that.pageSibling &&
                    (object)this.namespaceUri == (object)that.namespaceUri &&
                    (object)this.pageParent == (object)that.pageParent &&
                    (object)this.pageSimilar == (object)that.pageSimilar &&
                    (object)this.prefix == (object)that.prefix &&
                    (object)this.baseUri == (object)that.baseUri &&
                    this.lineNumBase == that.lineNumBase &&
                    this.linePosBase == that.linePosBase)
                {
                    return(true);
                }
            }
            return(false);
        }
All Usage Examples Of MS.Internal.Xml.Cache.XPathNodeInfoAtom::GetHashCode