这只是一个简单的问题,我有点难过......
据我所见,我实际上并没有在任何地方使用 char,因为 model.children 是 aIList<>
而 model.Name 是字符串,但是我的 foreach 循环给出了错误,即它无法将 char 转换为 catalogue.department,如果你需要任何更多信息,请随时询问。
private void DisplayOnWebsiteChecked(Object sender, EventArgs e)
{
var departments = model.Name;
var departmentChildren = model.Children;
if (departmentChildren != null)
{
int zeroChildren = 0;
if (departmentChildren.Count.Equals(zeroChildren));
{
foreach (Department Children in departments)
{
}
}
}
}
编辑:这个问题实际上已经修复,我将在下面发布固定代码,因为事实证明我实际上是通过将列表放在错误的位置来搞砸代码。
private void DisplayOnWebsiteChecked(Object sender, EventArgs e)
{
var departments = model.Name;
var departmentChildren = model.Children;
if (departmentChildren != null)
{
int zeroChildren = 0;
if (departmentChildren.Count.Equals(zeroChildren));
{
foreach (Department Child in departmentChildren)
{
}
}
}
}