Пример #1
0
 /// <summary>
 /// Returns true if the other experiment reference is equal to this one.
 /// </summary>
 public bool Equals(ExperimentReference otherReference)
 {
     if (ReferenceEquals(otherReference, null))
     {
         return(false);
     }
     else
     {
         return((Name ?? string.Empty).ToLower() == (otherReference.Name ?? string.Empty).ToLower() &&
                (User ?? string.Empty).ToLower() == (otherReference.User ?? string.Empty).ToLower() &&
                UncorrectedStartTime.ToString() == otherReference.UncorrectedStartTime.ToString() && // I am not sure why we have StartTime.ToString, but it maybe the time returned from the database is not exactly what we put in the database.
                Source.SafeEquals(otherReference.Source));
     }
 }
Пример #2
0
 /// <summary>
 /// Returns a hash code that takes into account the name, user, and start time.
 /// </summary>
 public override int GetHashCode()
 {
     // ToString on start time is to be consistent with equals.
     return(Name.ValueOrDefault(name => name.ToLower().GetHashCode()) ^ User.ValueOrDefault(user => user.ToLower().GetHashCode()) ^
            UncorrectedStartTime.ToString().GetHashCode() ^ Source.ValueOrDefault(source => source.GetHashCode()));
 }