System.Uri.GetHashCode C# (CSharp) Method

GetHashCode() public method

public GetHashCode ( ) : int
return int
        public override int GetHashCode()
        {
            if (IsNotAbsoluteUri)
            {
                return CalculateCaseInsensitiveHashCode(OriginalString);
            }

            // Consider moving hash code storage from m_Info.MoreInfo to m_Info
            UriInfo info = EnsureUriInfo();
            if ((object)info.MoreInfo == null)
            {
                info.MoreInfo = new MoreInfo();
            }
            int tempHash = info.MoreInfo.Hash;
            if (tempHash == 0)
            {
                string chkString = info.MoreInfo.RemoteUrl;
                if ((object)chkString == null)
                    chkString = GetParts(UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped);
                tempHash = CalculateCaseInsensitiveHashCode(chkString);
                if (tempHash == 0)
                {
                    tempHash = 0x1000000;   //making it not zero still large enough to be mapped to zero by a hashtable
                }
                info.MoreInfo.Hash = tempHash;
            }
            return tempHash;
        }

Usage Example

 public Db4oHistoryService(Uri baseUri, bool resume)
 {
     m_Resume = resume;
     m_Db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(),
         "NCrawlerHist_{0}.Yap".FormatWith(baseUri.GetHashCode()));
     ClearHistory();
 }
All Usage Examples Of System.Uri::GetHashCode