且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在视图中显示所有特定的XML元素?

更新时间:2023-02-10 12:40:11

这就是问题所在,我知道为什么我也被它欺骗了,因为我试图让事情超出循环,但不完全是你做的方式。;-)

太棒了!谢谢!



That's what the problem was and I know why I got tricked by it too since I have tried to have things outside the loop, but not exactly the way you did it. ;-)
Great! Thanks!

<pre>List<string> list = new List<string>();
foreach (var ProjNrList in Activity)
{
   list.Add(ProjNrList.Element("ProjectNr").Value);
}
ViewBag.ProjNrList = list;
return View();