-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Introduce generic math LINQ operators #71901
Comments
Tagging subscribers to this area: @dotnet/area-system-linq Issue DetailsWith generic math coming in C# 11, we can introduce generic versions of math LINQ operators. These would include Average, Sum, Max, Min, and would allow e.g. representing math over date/time types (e.g. TimeSpan). Note that if we end up implementing an identity ordering operator (without a key selector), as per #14729, we may want to think about what role, if any, IComparisonOperators would play there. In theory, either IComparable or IComparisonOperators is sufficient for such an operator. Note that this would include both enumerable and queryable versions. I specifically ran into this while considering how to represent a sum of time intervals operation for translation to SQL with EF Core. A generic Sum method would be perfect for that (TimeSpan would also to implement the appropriate interfaces as well).
|
Duplicate of #64031 |
Thanks, somehow missed this in my searches. |
With generic math coming in C# 11, we can introduce generic versions of math LINQ operators. These would include Average, Sum, Max, Min, and would allow e.g. representing math over date/time types (e.g. TimeSpan).
Note that if we end up implementing an identity ordering operator (without a key selector), as per #14729, we may want to think about what role, if any, IComparisonOperators would play there. In theory, either IComparable or IComparisonOperators is sufficient for such an operator.
Note that this would include both enumerable and queryable versions. I specifically ran into this while considering how to represent a sum of time intervals operation for translation to SQL with EF Core. A generic Sum method would be perfect for that (TimeSpan would also to implement the appropriate interfaces as well).
/cc @tannergooding @ajcvickers
The text was updated successfully, but these errors were encountered: