コード例 #1
0
ファイル: Lock.cs プロジェクト: AMVrijenhoek/slock_api
        /// <summary>
        /// Returns true if Lock instances are equal
        /// </summary>
        /// <param name="other">Instance of Lock to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Lock other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id
                     ) &&
                 (
                     OwnerId == other.OwnerId
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     RachetKey == other.RachetKey ||
                     RachetKey != null &&
                     RachetKey.Equals(other.RachetKey)
                 ) &&
                 (
                     RachetCounter == other.RachetCounter //||
                     // RatchetCounter != null &&
                     // RatchetCounter.Equals(other.RatchetCounter)
                 ));
        }
コード例 #2
0
ファイル: Lock.cs プロジェクト: AMVrijenhoek/slock_api
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (RachetKey != null)
         {
             hashCode = hashCode * 59 + RachetKey.GetHashCode();
         }
         // if (RatchetCounter != null)
         hashCode = hashCode * 59 + RachetCounter.GetHashCode();
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         return(hashCode);
     }
 }