-
Notifications
You must be signed in to change notification settings - Fork 381
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
Add type safety and improve type inference in UnitsMath.cs
#1373
Comments
This sounds useful, would you be interested in attempting a pull request? You can target |
Sounds great. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
PR is ready at #1374 |
Fixed by #1374 |
Is your feature request related to a problem? Please describe.
Some of the extension methods in
UnitsMath.cs
(e.g.Average
) take anEnum unitType
argument. Our system uses these extensively, and when copying/pasting code (and changing the quantity type because we're dealing with different sensors every time), I'd like the compiler to remind me I forgot to update the unit.Describe the solution you'd like
Change
into something like:
Describe alternatives you've considered
We tried implementing type safe methods in our own codebase, but when we use the wrong unit type, our IDE just falls back to the implementation in
UnitsMath
.Additional context
unitType
parameter (I haven't checked yet, mostly because they didn't come up in my use-case)The text was updated successfully, but these errors were encountered: