We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Chaining MoreLINQ's LastOrDefault with MinBy or MaxBy returns the first element instead of the last one.
LastOrDefault
MinBy
MaxBy
Below is a sample to reproduce the bug:
// Assuming: // using MoreLinq; var strings = new[] { "foo", "bar", "baz", "qux", "quux", "quuz", "corge", "grault", "garply", "waldo", "fred", "plugh", "xyzzy", "thud" }; Console.WriteLine("=== MinBy ==="); Console.WriteLine(strings.MinBy(s => s.Length).Last()); Console.WriteLine(strings.MinBy(s => s.Length).LastOrDefault()); Console.WriteLine("=== MaxBy ==="); Console.WriteLine(strings.MaxBy(s => s.Length).Last()); Console.WriteLine(strings.MaxBy(s => s.Length).LastOrDefault());
Expected:
=== MinBy === qux qux === MaxBy === garply garply
Instead, actual result when using version 3.3.2 (latest at time of reporting):
=== MinBy === qux foo === MaxBy === garply grault
The text was updated successfully, but these errors were encountered:
atifaziz
Successfully merging a pull request may close this issue.
Chaining MoreLINQ's
LastOrDefault
withMinBy
orMaxBy
returns the first element instead of the last one.Below is a sample to reproduce the bug:
Expected:
Instead, actual result when using version 3.3.2 (latest at time of reporting):
The text was updated successfully, but these errors were encountered: