In c#, I have this code
Pixel topLeft = potentialTopLeft.Min(p => p.GetX());
Which gets the smallest Pixel object in the list potentialTopLeft, but what it uses to compare the Pixel value is the value of the GetX() class method. But the problem is, it returns the value of the smallest GetX(), and I want the Pixel object with the smallest GetX(). Does anyone know how to fix it?
Applying Sort and than taking the first element from the IOrderedList:
var topLeft = potentialTopLeft.OrderBy(p => p.GetX()).FirstOrDefault();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With