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` as successors to `MinBy` & `MaxBy` #1019

Closed atifaziz closed 8 months ago

atifaziz commented 8 months ago

This PR closes #1018.

It introduces Minima as a replacement for MinBy and Maxima as a replacement for MaxBy.

MinBy and MaxBy are still there for compatibility, but marked obsolete. In .NET 6+, they are demoted from being extension methods to regular static ones, which should avoid conflicts with identically named methods introduced with .NET 6. Both methods are, however, exposed as extensions when statically imported via MoreEnumerable.Extensions.MinByExtension and MoreEnumerable.Extensions.MaxByExtension. These can conflict when a project migrates to .NET 6, but that would have happened anyway. These extensions are also marked as being superseded by their successors and so the developer should be guided to make the required change by using either MoreEnumerable.Extensions.MinimaExtension/MoreEnumerable.Extensions.MaximaExtension or simply reverting to importing MoreLinq.

codecov[bot] commented 8 months ago

Codecov Report

Merging #1019 (ae78e1e) into master (dd8e8a8) will not change coverage. The diff coverage is 93.96%.

:exclamation: Current head ae78e1e differs from pull request most recent head 3060351. Consider uploading reports for the commit 3060351 to get more accurate results

@@           Coverage Diff           @@
##           master    #1019   +/-   ##
=======================================
  Coverage   92.63%   92.63%           
=======================================
  Files         113      113           
  Lines        3421     3421           
  Branches     1056     1056           
=======================================
  Hits         3169     3169           
  Misses        189      189           
  Partials       63       63           
Files Coverage Δ
MoreLinq/Minima.cs 100.00% <100.00%> (ø)
MoreLinq/Maxima.cs 93.45% <93.45%> (ø)

... and 2 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more