我正在尝试将对象列表嵌套在列表中;我尝试了以下方法:
实例化:
public static List<PhonePeople> Helpdesk, Admins = new List<PhonePeople>();
public static List<List<PhonePeople>> PDepartments =
new List<List<PhonePeople>>{Helpdesk,Admins};
尝试添加到服务台列表,如下所示:
MainWindow.PDepartments[counter].Add(thisPerson);
错误:
“你调用的对象是空的”
我将计数器定义为0,0是帮助台的索引。静态列表所在的是Mainwindow。我认为我的列表列表或添加方式有问题;
怎么了?
您的行public static List<PhonePeople> Helpdesk, Admins = new List<PhonePeople>();
只实例化Admins
不HelpDesk
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句