-
Notifications
You must be signed in to change notification settings - Fork 391
Units property should not include Undefined value #437
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
Comments
If we remove Is this considered a breaking change, since someone may be be doing their own checking for something like |
Updated link: UnitsNet/UnitsNet/GeneratedCode/Quantities/Length.g.cs Lines 161 to 164 in 5f2b075
As you can see, I didn't mean to remove the The motivation for this change, which I forgot to mention in the description, is that some people complained I would not consider this a breaking change, as I rather consider it a bug that the value was included to begin with. The code change would be something like
|
Ah, that does make more sense. I am submitting a PR to do this - I just took your suggested solution. |
https://github.com/angularsen/UnitsNet/blob/master/UnitsNet/GeneratedCode/Quantities/Length.g.cs#L164
Similar for all quantities, Length only chosen as an example.
It doesn't make sense to include the
LengthUnit.Undefined = 0
value, since it is not meant to be used. UnitsNet will throw exception if you try to use this value for anything in methods accepting a unit value, as the intent is to help you catch bugs where you forgot to initialize the value such as when deserializing data.The text was updated successfully, but these errors were encountered: