David Smith

David Smith

  • NA
  • 2k
  • 0

Dynamic Collection Initializer

Jul 28 2016 5:47 PM

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)