So I have a list of Car objects.
List<Car> cars = GetCars();
I want to create a list of strings that come from the Car.Name string property.
I could do this:
List<string> carNames = new List<string>();
foreach(Car car in cars)
{
carNames.Add(car.Name);
}
Is there a more fancy way to do this? Can you do this using LINQ?