-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Period does not implement operator == #1529
Comments
Nicely found. That's a surprise. Adding the operators is technically a breaking change, but will only make broken code fail, I suspect. It won't break binary compatibility, although it will change the meaning of existing code. @malcolmr any thoughts? |
Labelled as both a bug and an enhancement in that violating the principle of least surprise is arguably a bug :) |
I think it's reasonable to call this a bugfix and then also call it out in the migration guide. (Does this also affect equivalence for any dictionary or set-like containers, or do they all use IComparable?) Is there any way to verify that we haven't missed any operators from any other types? |
Set-like things should all be using Equals, which is already implemented. I could write a test for "classes that implement |
Have now automated this via a unit test. The current type that implement
MapZone is sufficiently complex that I don't think it's appropriate to overload |
I happened to create two zero-length periods two different ways to test for equality like so:
var period1 = Period.Zero;
var period2 = PeriodPattern.Roundtrip.Parse("P0D").Value;
Doing
period1 == period2
compiles just fine. However, the result was not what I expected. This returnsfalse
, nottrue
. On the other hand, doingperiod1.Equals(period2)
does return the expected result oftrue
.The text was updated successfully, but these errors were encountered: