Пример #1
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // Overflow is fine, just wrap
            unchecked
            {
                var hashCode = 41;

                // Suitable nullity checks etc, of course :)
#pragma warning disable CA1307 // Specify StringComparison

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Id != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Id.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Title != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Title.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Description != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Description.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (TalkRehearsals != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + TalkRehearsals.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (MeetupDraft != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + MeetupDraft.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Speakers != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Speakers.GetHashCode();
                }
#pragma warning restore CA1307 // Specify StringComparison
                return(hashCode);
            }
        }
Пример #2
0
        /// <inheritdoc />
        /// <summary>
        /// Returns true if TalkDraft instances are equal
        /// </summary>
        /// <param name="other">Instance of TalkDraft to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(TalkDraft other)
        {
#pragma warning disable IDE0041 // Use 'is null' check
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

#pragma warning disable CA1309                  // Use ordinal stringcomparison
#pragma warning disable CA1307                  // Specify StringComparison
#pragma warning disable SA1515                  // Single-line comment must be preceded by blank line
#pragma warning disable SA1009                  // Closing parenthesis must be spaced correctly
            return
                (#pragma warning disable SA1119 // Statement must not use unnecessary parenthesis
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Id, other.Id) ||
                     (Id != null && Id.Equals(other.Id))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Title, other.Title) ||
                     (Title != null && Title.Equals(other.Title))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Description, other.Description) ||
                     (Description != null && Description.Equals(other.Description))
                 ) &&
                 (
                     TalkRehearsals == other.TalkRehearsals ||
                     (TalkRehearsals != null && TalkRehearsals.SequenceEqual(other.TalkRehearsals))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(MeetupDraft, other.MeetupDraft) ||
                     (MeetupDraft != null && MeetupDraft.Equals(other.MeetupDraft))
                 ) &&
                 (
                     Speakers == other.Speakers ||
                     (Speakers != null && Speakers.SequenceEqual(other.Speakers))
                 ));

#pragma warning restore SA1119 // Statement must not use unnecessary parenthesis
#pragma warning restore SA1009 // Closing parenthesis must be spaced correctly
#pragma warning restore SA1515 // Single-line comment must be preceded by blank line
#pragma warning restore CA1307 // Specify StringComparison
#pragma warning restore CA1309 // Use ordinal stringcomparison
        }