不显示属性列表数据
Property list data not displaying
Gateway.cs页数
public class gatewayConnectionPropertyData
{
public string url { get; set; }
public int type { get; set; }
public string service_desc { get; set; }
}
protected void btnAddEdit_Click(object sender, EventArgs e)
{
gatewayConnectionPropertyData proposal = new gatewayConnectionPropertyData();
proposal.url = "/testproposal.xml";
proposal.type = 13;
proposal.service_desc = "proposal";
gatewayConnectionPropertyData utility = new gatewayConnectionPropertyData();
proposal.url = "/testUtulity.xml";
proposal.type = 12;
proposal.service_desc = "utility";
gatewayConnectionPropertyData intelligence = new gatewayConnectionPropertyData();
proposal.url = "/testinteligence.xml";
proposal.type = 53;
proposal.service_desc = "intelligence";
List<gatewayConnectionPropertyData> mydataList = new List<gatewayConnectionPropertyData>();
gatewayConnectionPropertyDataList.Add(proposal);
gatewayConnectionPropertyDataList.Add(utility);
gatewayConnectionPropertyDataList.Add(intelligence);
}
mydataList 总是计数 3 但只出现 l最后添加的项目 我可以看不到所有数据 我想念我需要什么 change.If 我可以在我这边申请 更好的解决方案以创建属性列表模型的任何意见 .
谢谢。
首先,您要在 gatewayConnectionPropertyDataList
中添加项目(我不确定它是什么),但如果您希望在 mydataList
中添加数据,则只需添加此变量。此外,您可以像这样使用 collection initializers
:-
List<gatewayConnectionPropertyData> mydataList =
new List<gatewayConnectionPropertyData>
{
new gatewayConnectionPropertyData { url = "/testproposal.xml", type = 13,
service_desc = "proposal" },
new gatewayConnectionPropertyData { url = "/testUtulity.xml", type = 12,
service_desc = "utility" },
new gatewayConnectionPropertyData { url = "/testinteligence.xml", type = 53,
service_desc = "intelligence" },
};
Gateway.cs页数
public class gatewayConnectionPropertyData
{
public string url { get; set; }
public int type { get; set; }
public string service_desc { get; set; }
}
protected void btnAddEdit_Click(object sender, EventArgs e)
{
gatewayConnectionPropertyData proposal = new gatewayConnectionPropertyData();
proposal.url = "/testproposal.xml";
proposal.type = 13;
proposal.service_desc = "proposal";
gatewayConnectionPropertyData utility = new gatewayConnectionPropertyData();
proposal.url = "/testUtulity.xml";
proposal.type = 12;
proposal.service_desc = "utility";
gatewayConnectionPropertyData intelligence = new gatewayConnectionPropertyData();
proposal.url = "/testinteligence.xml";
proposal.type = 53;
proposal.service_desc = "intelligence";
List<gatewayConnectionPropertyData> mydataList = new List<gatewayConnectionPropertyData>();
gatewayConnectionPropertyDataList.Add(proposal);
gatewayConnectionPropertyDataList.Add(utility);
gatewayConnectionPropertyDataList.Add(intelligence);
}
mydataList 总是计数 3 但只出现 l最后添加的项目 我可以看不到所有数据 我想念我需要什么 change.If 我可以在我这边申请 更好的解决方案以创建属性列表模型的任何意见 .
谢谢。
首先,您要在 gatewayConnectionPropertyDataList
中添加项目(我不确定它是什么),但如果您希望在 mydataList
中添加数据,则只需添加此变量。此外,您可以像这样使用 collection initializers
:-
List<gatewayConnectionPropertyData> mydataList =
new List<gatewayConnectionPropertyData>
{
new gatewayConnectionPropertyData { url = "/testproposal.xml", type = 13,
service_desc = "proposal" },
new gatewayConnectionPropertyData { url = "/testUtulity.xml", type = 12,
service_desc = "utility" },
new gatewayConnectionPropertyData { url = "/testinteligence.xml", type = 53,
service_desc = "intelligence" },
};