Exemple #1
0
        public override int GetHashCode()
        {
            int ret = 0;

            if (Subject != null)
            {
                ret = unchecked (ret + Subject.GetHashCode());
            }
            if (Predicate != null)
            {
                ret = unchecked (ret + Predicate.GetHashCode());
            }
            if (Object != null)
            {
                ret = unchecked (ret + Object.GetHashCode());
            }
            if (Meta != null)
            {
                ret = unchecked (ret + Meta.GetHashCode());
            }
            return(ret);
        }
 /// <summary>
 /// Writes the URI of the specified entity to the output writer.
 /// </summary>
 /// <param name="entity">The entity.</param>
 protected virtual void WriteEntityByUri(Entity entity)
 {
     if (entity is BNode)
     {
         Write(entity is Variable ? "?" : "_:");
         WriteEscaped(((BNode)entity).LocalName ?? ("bnode" + Math.Abs(entity.GetHashCode())));
     }
     else
     {
         string prefix, localname;
         if (m_NamespaceManager.Normalize(entity.Uri, out prefix, out localname))
         {
             WriteEscaped(prefix);
             Write(':');
             WriteEscaped(localname);
         }
         else
         {
             Write('<');
             WriteEscaped(entity.Uri);
             Write('>');
         }
     }
 }