Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            string left = Identifier.Canonicalize(m_identifier.ID);
            int    hash = left.GetHashCode();

            if (m_next != null)
            {
                hash ^= m_next.GetHashCode();
            }

            return(hash);
        }
Ejemplo n.º 2
0
        public int CompareTo(object obj)
        {
            DbObject other = obj as DbObject;

            if (other == null)
            {
                throw new ArgumentException("Object is not a DbObject.", "obj");
            }

            string left  = Identifier.Canonicalize(Identifier.ID);
            string right = Identifier.Canonicalize(other.Identifier.ID);

            int cmp = left.CompareTo(right);

            if (cmp != 0)
            {
                return(cmp);
            }

            if (m_next != null)
            {
                DbObject tail = other.Next;
                if (tail == null)
                {
                    return(1);
                }
                else
                {
                    return(m_next.CompareTo(tail));
                }
            }
            else
            {
                return(other.HasNext ? -1 : 0);
            }
        }