I have two different class and there is a relation between them. Car_Model class refers Car class with Car_ID.
To map these two class object to each other, I created relation named class. How can I assign car and modelCar into this class without making iteration? Can Linq solve this problem?
public class Car
{
public int ID;
public String name;
}
public class Car_Model
{
public int ID;
public int Car_ID;
public String date;
}
public class relation
{
public Car car;
public Car_Model carModel;
}
I did not use entity framework.
List<Car> carList = new List<Car>();
List<Car_Model> carModelList = new List<Car_Model>();
Car car = new Car();
car.ID = 1;
car.name = "blabla";
carList.add(car);
Car_Model carModel = new Car_Model();
carModel.ID = 1;
carModel.Car_ID = 1;
carModel.date = "01.01.2013";
carModelList.add(carModel );