コード例 #1
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var result = (_document != null ? _document.GetHashCode() : 0);
         result = (result * 397) ^ (_collectionName != null ? _collectionName.GetHashCode() : 0);
         result = (result * 397) ^ (_id != null ? _id.GetHashCode() : 0);
         result = (result * 397) ^ (_metadata != null ? _metadata.GetHashCode() : 0);
         return(result);
     }
 }
コード例 #2
0
 /// <summary>
 /// Equalses the specified obj.
 /// </summary>
 /// <param name="document">The obj.</param>
 /// <returns></returns>
 public bool Equals(Document document)
 {
     if (document == null)
     {
         return(false);
     }
     if (_orderedKeys.Count != document._orderedKeys.Count)
     {
         return(false);
     }
     return(GetHashCode() == document.GetHashCode());
 }