I'm trying to get a value from an Interface. I have a function like this:
public IEnumerable<Car> CreateCars()
{
IEnumerable<Car> carList = new List<Car>()
{
new Car{ Id = 1, Name = "Opel", CarProperties = { Color= "White", Model= "2012" }},
new Car{ Id = 2, Name = "Citroen", CarProperties = { Color= "Blue", Model = "2014" }},
new Car{ Id = 6, Name = "Peugeot", CarProperties = { Color= "Red", Model = "2013" } }
};
return carList;
}
When I call the method it gives exception:
object reference not set to instance of an object.
I searched but could not find an answer. Can you help me to solve this problem?