I have a model class which has few properties, one of which is list of integers. I created an instance of this class in the controller and I want to add the ids on some logic to this list. This throws the below error. Can someone help me understand how should the list be initialized? Any help is appreciated, Thanks. Model
Public class A
{
public int countT { get; set; }
public int ID { get; set; }
public List<int> itemsForDuplication { get; set; }
}
Controller
A Info = new A();
Info.itemsForDuplication.Add(relatedItem.Id);