I am trying to nest a list of objects in a list; I have tried the following:
Instantiation:
public static List<PhonePeople> Helpdesk, Admins = new List<PhonePeople>();
public static List<List<PhonePeople>> PDepartments =
new List<List<PhonePeople>>{Helpdesk,Admins};
Attempting to add to the helpdesk list as follows:
MainWindow.PDepartments[counter].Add(thisPerson);
Error:
"Object reference not set to an instance of an object"
I defined counter to 0 , 0 is the index for helpdesk. Mainwindow is where the static list resides. I believe there is an issue with my List of list's or the way i am adding to it;
whats wrong?