예제 #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is BusinessHoursPeriod other &&
                   ((DayOfWeek == null && other.DayOfWeek == null) || (DayOfWeek?.Equals(other.DayOfWeek) == true)) &&
                   ((StartLocalTime == null && other.StartLocalTime == null) || (StartLocalTime?.Equals(other.StartLocalTime) == true)) &&
                   ((EndLocalTime == null && other.EndLocalTime == null) || (EndLocalTime?.Equals(other.EndLocalTime) == true)));
        }
예제 #2
0
        public override int GetHashCode()
        {
            int hashCode = 870467587;

            if (DayOfWeek != null)
            {
                hashCode += DayOfWeek.GetHashCode();
            }

            if (StartLocalTime != null)
            {
                hashCode += StartLocalTime.GetHashCode();
            }

            if (EndLocalTime != null)
            {
                hashCode += EndLocalTime.GetHashCode();
            }

            return(hashCode);
        }