I'm trying to get an object in a list of objects that has the highest score. If there are two or more objects with equal high scores, I can get the first, either, or any.
Is the code below the best way to do it, or is there a better way?
List<AddressCandidate> returnedCandidates = args.Results;
// Get the AddressCandidate with the highest addressCandidate score.
AddressCandidate addCand = (
from address in returnedCandidates
let high = returnedCandidates.Max(highest => highest.Score)
where address.Score == high