1
Answer

Dynamic Collection Initializer

David Smith

David Smith

8y
237
1

How to turn or change the logic below into a dynamic collection initializer in code. I want to do this dynamically base upon new incoming data or new incoming cars.


List<Car> cars = new List<Car>  
{
new Car { Name = "Corvette", Color = Color.Yellow },
new Car { Name = "Golf", Color = Color.Blue}
};
Answers (1)