So let's say I have a type Car
with two properties Speed
and Color
public class Car
{
public int Speed {get; set;}
public string Color {get; set;}
}
Using LINQ I may find the minimum speed
int minSpeed = collection.Min(em => em.Speed);
so minSpeed will contain the value of speed of the car with the minimum speed in collection.
But how can I do something similar to get the color of the car?
Something like:
string color = collection.Min(em => em.Speed).Select(x => x.Color);