/// -------------------------------------------------------------------------------- /// <summary> /// Compares times to nearest second. /// </summary> /// -------------------------------------------------------------------------------- private bool ApproximatelyEqualTimes(ScrNoteKey key) { if (m_dateCreated.Ticks == 0 || key.m_dateCreated.Ticks == 0) { return(true); } return(m_dateCreated.Ticks / TICKS_TO_SECONDS == key.m_dateCreated.Ticks / TICKS_TO_SECONDS); }
/// -------------------------------------------------------------------------------- /// <summary> /// Indicates whether this instance and a specified object are equal. /// </summary> /// <param name="obj">Another object to compare to.</param> /// <returns> /// true if <paramref name="obj"/> and this instance are the same type and represent /// the same value; otherwise, false. /// </returns> /// -------------------------------------------------------------------------------- public override bool Equals(object obj) { if (obj == null || !(obj is ScrNoteKey)) { return(false); } ScrNoteKey key = (ScrNoteKey)obj; return(m_guidAnnotationType == key.m_guidAnnotationType && m_sDiscussionPara1 == key.m_sDiscussionPara1 && m_sQuotePara1 == key.m_sQuotePara1 && m_sRecommendationPara1 == key.m_sRecommendationPara1 && m_startReference == key.m_startReference && m_endReference == key.m_endReference && ApproximatelyEqualTimes(key)); }