使用getter访问属性时,我得到NULL。我已将其更改为公开,以测试其他所有功能是否正常运行,是的,没有其他问题。
HT省级
public string provinceCode;
public string ProvinceCode
{
get; set;
}
形式
public Form1()
{
//HTGetProvinces() returns a list of provinces
InitializeComponent();
List<HTProvince> provinceList =
HTProvince.HTGetProvinces();
foreach (HTProvince x in provinceList)
{
//Works. Adds items the province code property of for each item to my list
provincesListBox.Items.Add(x.provinceCode);
//throws null exception. Doesn't work
provincesListBox.Items.Add(x.ProvinceCode);
}
}
侃侃尔雅
慕桂英4014372
相关分类