コード例 #1
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (UserName.Length != 0)
        {
            hash ^= UserName.GetHashCode();
        }
        if (BookName.Length != 0)
        {
            hash ^= BookName.GetHashCode();
        }
        if (BorrowTime.Length != 0)
        {
            hash ^= BorrowTime.GetHashCode();
        }
        if (ReturnTime.Length != 0)
        {
            hash ^= ReturnTime.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
コード例 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int dictHash = 17;
         foreach (KeyValuePair <string, string> kv in this.BookDictionary)
         {
             dictHash = dictHash * 23 + kv.Key.GetHashCode();
             dictHash = dictHash * 23 + (kv.Value ?? "").GetHashCode();
         }
         return(((BookName != null ? BookName.GetHashCode() : 0) * 397) ^ dictHash);
     }
 }