❔ Finding max from the list using lambda expression
Hello, I have an example of a following list, something like {1, 2, 3, 4, 5, 6}
I want to find the max element of this list using lambda expression. So this is what I coded
Do we have to fill in the expression in List.Max? Is there other way to do it? Thank you.
3 Replies
In .NET 7 at least there's an overload that doesn't take a selector
Actually present as far back as .NET 5 and Framework 4.8.1 but it obviously requires the collection to be a numeric type which it is in your case.
When typing the method name, you can click the arrows to see the overloads
thinker227#5176
REPL Result: Success
Result: int
Compile: 438.641ms | Execution: 44.249ms | React with ❌ to remove this embed.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.