/// <summary>
        /// Compares two QualifiedNames.
        /// </summary>
        /// <param name="obj">The object to compare to.</param>
        /// <returns>
        /// Less than zero if the instance is less than the object.
        /// Zero if the instance is equal to the object.
        /// Greater than zero if the instance is greater than the object.
        /// </returns>
        public int CompareTo(object obj)
        {
            if (Object.ReferenceEquals(obj, null))
            {
                return(-1);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(0);
            }
            QualifiedName _qualifiedName = obj as QualifiedName;

            if (_qualifiedName == null)
            {
                return(typeof(QualifiedName).GUID.CompareTo(obj.GetType().GUID));
            }
            if (_qualifiedName.NamespaceIndex != NamespaceIndex)
            {
                return(NamespaceIndex.CompareTo(_qualifiedName.NamespaceIndex));
            }
            if (Name != null)
            {
                return(String.CompareOrdinal(Name, _qualifiedName.Name));
            }
            return(-1);
        }
        public override int GetHashCode()
        {
            int hashCode = 387039986;

            hashCode = hashCode * -1521134295 + NamespaceIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + IdType.GetHashCode();
            switch (IdType)
            {
            case IdType.Numeric:
                hashCode = hashCode * -1521134295 + EqualityComparer <uint> .Default.GetHashCode((uint)Identifier);

                break;

            case IdType.String:
                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode((string)Identifier);

                break;

            case IdType.Guid:
                hashCode = hashCode * -1521134295 + EqualityComparer <Guid> .Default.GetHashCode((Guid)Identifier);

                break;

            case IdType.Opaque:
                hashCode = hashCode * -1521134295 + ByteSequenceComparer.GetHashCode((byte[])Identifier);
                break;
            }

            return(hashCode);
        }