CampaignService service = new CampaignService();
Campaign[] CampaignList = service.getAllCampaigns(0);
foreach (Campaign c in CampaignList)
{
Keyword[] KeywordList = c.campaignNegativeKeywords;
foreach(Keyword k in KeywordList)----未将对象引用设置到对象的实例,为什么呀?????
{
ListBox1.Items.Add("");
ListBox1.Items.Add(k.id.ToString());
ListBox1.Items.Add(k.text);
}
}
Campaign[] CampaignList = service.getAllCampaigns(0);
foreach (Campaign c in CampaignList)
{
Keyword[] KeywordList = c.campaignNegativeKeywords;
foreach(Keyword k in KeywordList)----未将对象引用设置到对象的实例,为什么呀?????
{
ListBox1.Items.Add("");
ListBox1.Items.Add(k.id.ToString());
ListBox1.Items.Add(k.text);
}
}
类数组在定义并初始化时,并没有实际创建比如有个类叫class1
class1[] classes=new class1[10];这样其实并未创建10个实例而只是创建了一个够放10个class1的数组空间而已。
if (KeywordList != null) {
foreach(Keyword k in KeywordList)
{
ListBox1.Items.Add("");
ListBox1.Items.Add(k.id.ToString());
ListBox1.Items.Add(k.text);
}
}
if (KeywordList != null) {
foreach(Keyword k in KeywordList)
{
ListBox1.Items.Add("");
ListBox1.Items.Add(k.id.ToString());
ListBox1.Items.Add(k.text);
}
}