System.LINQ.Dynamic: Select(“ new classname (…)”) into a List<T> (or any other enumerable collection of <T>)

Viewed 3889

What I want but instead of doing

var carsPartial = cars.Select("new(name, year)").ToList();

I want to do this:

var carsPartial = cars.Select<car>("new car(name, year)").ToList<car>();

Thanks again and ask for clarification if needed.

car class:

 public class car
{
    public string name { get; set; }
    public int year { get; set; }
}

What is in cars: a bunch of cars data with names and years sort of like a database.

2 Answers
Related