-
Notifications
You must be signed in to change notification settings - Fork 387
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
Fully embrace INumber and generic math of .NET 7 #1129
Comments
The biggest question is the supported deployments. Do we abandon netstandard/netframework support just for generic math? Neither are EOL yet. |
You could only support it a future mayor version without downlevel support. Also, would multitargeting be an option? |
We already do, but without too many #ifs. I fear that the API support for generic math vs precompiled lambdas would be difficult to maintain with equivalent functionality. But definitely worth a try. |
My guess would be that IQuantity<TUnitType> would need to derive from INumber<TSelf> somehow, right? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Some support for generic math was added in #1164 , it can be extended further. |
Awesome! What version of UnitsNet has generic math included? |
v5 has it 👍 There are a couple of extension methods Sum() and Average() in |
.NET 7 will introduce the INumber<TSelf> interface (along with accompanying with C# 11 features) that make a feature called generic math possible.
I think this would be a perfect fit for the quantities of UnitsNet and could potentially make the usage way more intuitive, flexible and overall enjoyable.
Please consider to fully embrace
INumber<TSelf>
and generic math in a future version of UnitsNet.Here is a short introduction to this feature set by @MadsTorgersen (first 25 minutes): Where's C# headed? - Mads Torgersen - NDC Copenhagen 2022
Official documentation: https://docs.microsoft.com/en-us/dotnet/standard/generics/math
The text was updated successfully, but these errors were encountered: