我有以下课程:
public class Core {
SyncList<myItem> ITEM = new SyncList<myItem>;
public void addSubitem(){
subItem i = new subItem();
i.itemType = "TYPE1"; // not updating
ITEM[0].sItem.Add(i);
}
}
public class myItem {
public SyncList<subItem> = sItem new SyncList<subItem>();
}
public class subItem {
public string itemType { get; set; }
public subItem(){
this.itemType = "TYPE1"; // not updating
}
}
这就是我在主窗体上定义它的方式:
public static Core core { get; set; }
core = new Core(); // assigned in form constructor
这就是我称之为 onClick 事件的方式:
core.addSubitem();
但它不会更新,并且 itemType 变量一直为空。我不明白为什么会这样..有什么想法吗?谢谢!