Ejemplo n.º 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 (Unit != null)
                {
                    hashCode = hashCode * 59 + Unit.GetHashCode();
                }
                if (Post != null)
                {
                    hashCode = hashCode * 59 + Post.GetHashCode();
                }
                if (PostingType != null)
                {
                    hashCode = hashCode * 59 + PostingType.GetHashCode();
                }
                if (AssignmentNo != null)
                {
                    hashCode = hashCode * 59 + AssignmentNo.GetHashCode();
                }
                if (Team != null)
                {
                    hashCode = hashCode * 59 + Team.GetHashCode();
                }

                hashCode = hashCode * 59 + IsPrimary.GetHashCode();
                return(hashCode);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns true if Posting instances are equal
        /// </summary>
        /// <param name="other">Instance of Posting to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Posting other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Unit == other.Unit ||
                     Unit != null &&
                     Unit.Equals(other.Unit)
                     ) &&
                 (
                     Post == other.Post ||
                     Post != null &&
                     Post.Equals(other.Post)
                 ) &&
                 (
                     PostingType == other.PostingType ||
                     PostingType != null &&
                     PostingType.Equals(other.PostingType)
                 ) &&
                 (
                     AssignmentNo == other.AssignmentNo ||
                     AssignmentNo != null &&
                     AssignmentNo.Equals(other.AssignmentNo)
                 ) &&
                 (
                     Team == other.Team ||
                     Team != null &&
                     Team.Equals(other.Team)
                 ) &&
                 (
                     IsPrimary == other.IsPrimary ||

                     IsPrimary.Equals(other.IsPrimary)
                 ));
        }