Compare two date ranges for equality¶
Compare two date ranges for structural equality, triggered when caller compares ranges.
| Field | Value |
|---|---|
| Operation ID | OP-015 |
| Trigger | Caller compares ranges |
| Inputs | Two ranges |
| Outputs | Boolean / int |
| Primary components | DateRange.operator ==` / `operator !=` / `Equals(object)` / `GetHashCode()`, and `DateRangeExtensions.IsEqual |
| Entry point | Common/SAIF.Common/Classes/DateRange.cs |
Steps¶
operator ==(DateRange d1, IDateRange d2)returns true only when bothBeginDateandEndDatematch. (BR-034)operator !=independently returns true when either endpoint differs — it is not implemented as!(==). (BR-034)Equals(object obj)type-checks forIDateRangeand defers tooperator ==; anything else returnsfalse. (BR-034)GetHashCode()returns the arithmetic sum of the two endpoint hash codes.DateRangeExtensions.IsEqual(range1, range2)performs the same endpoint comparison but additionally null-guardsrange2, returningfalsewhen it is null. (BR-034)
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start(["Caller compares<br>two date ranges"]) --> S1["operator ==: true only when<br>both BeginDate and EndDate match"]
S1 --> S2["operator !=: independently checks<br>if either endpoint differs"]
S2 --> S3["Equals(object): type-checks<br>IDateRange, defers to operator =="]
S3 --> S4["GetHashCode(): sum of<br>both endpoint hash codes"]
S4 --> S5["IsEqual: same comparison,<br>null-guards range2"]
S5 --> End([Return comparison result])
Failure and edge-case behavior¶
- The operators dereference both operands without null checks, so comparing against
nullraisesNullReferenceException.*
Related documentation¶
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
Common/SAIF.Common/Classes/DateRange.csCommon/SAIF.Common/Extensions/DateRangeExtensions.cs