Пример #1
0
 /// <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 (Class != null)
         {
             hashCode = hashCode * 59 + Class.GetHashCode();
         }
         if (AvailablePhysicalMemory != null)
         {
             hashCode = hashCode * 59 + AvailablePhysicalMemory.GetHashCode();
         }
         if (AvailableSwapSpace != null)
         {
             hashCode = hashCode * 59 + AvailableSwapSpace.GetHashCode();
         }
         if (TotalPhysicalMemory != null)
         {
             hashCode = hashCode * 59 + TotalPhysicalMemory.GetHashCode();
         }
         if (TotalSwapSpace != null)
         {
             hashCode = hashCode * 59 + TotalSwapSpace.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #2
0
        /// <summary>
        /// Returns true if SwapSpaceMonitorMemoryUsage2 instances are equal
        /// </summary>
        /// <param name="other">Instance of SwapSpaceMonitorMemoryUsage2 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SwapSpaceMonitorMemoryUsage2 other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Class == other.Class ||
                     Class != null &&
                     Class.Equals(other.Class)
                     ) &&
                 (
                     AvailablePhysicalMemory == other.AvailablePhysicalMemory ||

                     AvailablePhysicalMemory.Equals(other.AvailablePhysicalMemory)
                 ) &&
                 (
                     AvailableSwapSpace == other.AvailableSwapSpace ||

                     AvailableSwapSpace.Equals(other.AvailableSwapSpace)
                 ) &&
                 (
                     TotalPhysicalMemory == other.TotalPhysicalMemory ||

                     TotalPhysicalMemory.Equals(other.TotalPhysicalMemory)
                 ) &&
                 (
                     TotalSwapSpace == other.TotalSwapSpace ||

                     TotalSwapSpace.Equals(other.TotalSwapSpace)
                 ));
        }