morelinq / MoreLINQ

Extensions to LINQ to Objects
https://morelinq.github.io/
Apache License 2.0
3.63k stars 409 forks source link

Add `Minima` & `Maxima` to supersede `MinBy` & `MaxBy` #1018

Closed atifaziz closed 8 months ago

atifaziz commented 8 months ago

PR #945 addressed most conflicts with .NET, but just two exceptions remain:

Does not address issues with MinBy/MaxBy per other discussions.

Let's consider adding Minima and Maxima, respectively. While it's going to be a never-ending chase to avoid conflicts with .NET, as more identically named methods may continue to land in future releases, it's worth making an exception for the only two remaining conflicting methods at this conjuncture to fully address #565 (for now).

Minima and Maxima seem like reasonable names since both operators return sequences so the plural forms of minimum and maximum seem appropriate. A By suffix seems unnecessary as using these methods on scalar values is expected to be super rare and so requiring a key selector won't be a surprise for or inconvenient to most.

MinBy and MaxBy should be marked obsolete and converted to regular static methods for .NET 6+ (as was done in #945).