Exemple #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 (CpuCores != null)
                {
                    hashCode = hashCode * 59 + CpuCores.GetHashCode();
                }

                if (Preemptible != null)
                {
                    hashCode = hashCode * 59 + Preemptible.GetHashCode();
                }

                if (RamGb != null)
                {
                    hashCode = hashCode * 59 + RamGb.GetHashCode();
                }

                if (DiskGb != null)
                {
                    hashCode = hashCode * 59 + DiskGb.GetHashCode();
                }

                if (Zones != null)
                {
                    hashCode = hashCode * 59 + Zones.GetHashCode();
                }

                return(hashCode);
            }
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (CpuCores != null ? CpuCores.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TaskHeapMemory != null ? TaskHeapMemory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TaskOffHeapMemory != null ? TaskOffHeapMemory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OnHeapManagedMemory != null ? OnHeapManagedMemory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OffHeapManagedMemory != null ? OffHeapManagedMemory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ExtendedResources != null ? ExtendedResources.GetHashCode() : 0);
         return(hashCode);
     }
 }