Exemple #1
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + Id.GetHashCode();
                hash = hash * 59 + MinistryRegionID.GetHashCode();

                if (Name != null)
                {
                    hash = hash * 59 + Name.GetHashCode();
                }

                hash = hash * 59 + StartDate.GetHashCode();

                if (RegionNumber != null)
                {
                    hash = hash * 59 + RegionNumber.GetHashCode();
                }

                if (EndDate != null)
                {
                    hash = hash * 59 + EndDate.GetHashCode();
                }

                return(hash);
            }
        }
Exemple #2
0
        /// <summary>
        /// Returns true if Region instances are equal
        /// </summary>
        /// <param name="other">Instance of Region to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Region other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     MinistryRegionID == other.MinistryRegionID ||
                     MinistryRegionID.Equals(other.MinistryRegionID)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     StartDate == other.StartDate ||
                     StartDate.Equals(other.StartDate)
                 ) &&
                 (
                     RegionNumber == other.RegionNumber ||
                     RegionNumber != null &&
                     RegionNumber.Equals(other.RegionNumber)
                 ) &&
                 (
                     EndDate == other.EndDate ||
                     EndDate != null &&
                     EndDate.Equals(other.EndDate)
                 ));
        }