如何仅使用XElement类循环此字符串列表并显示以下输出? [英] how do i loop this string list using only XElement class and display the below output?
本文介绍了如何仅使用XElement类循环此字符串列表并显示以下输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是XML文件....
This is the XML File....
<Photos>
<Photo> p1.jpg </Photo>
<Photo> p2.jpg </Photo>
<Photo> p3.jpg </Photo>
<Photo> p4.jpg </Photo>
<Photo> p5.jpg </Photo>
</Photos>
这是需要的输出!
p1.jpg
p2.jpg
p3.jpg
p4.jpg
p5.jpg
这就是我所做的事情!
我不需要读取外部xml文件我需要对值进行硬编码并将其显示在字符串列表中!就是这样!
This is the Output Needed!
p1.jpg
p2.jpg
p3.jpg
p4.jpg
p5.jpg
This is What i have Done so Far!
I dont need to read an external xml file i need to hard code the values and display them in a string list! thats it!
namespace ConsoleApplication2
{
class CSV
{
public List<Photos> ReadPhotosXML()
{
List<Photos> Photos = new List<Photos>();
Photos p = new Photos();
推荐答案
试试这个
在C#中使用XElement读取XML [ ^ ]
http:// stackoverflow .com / questions / 11225051 / how-to-read-xml-file-in-c [ ^ ]
try this
Read the XML using XElement in C#[^]
http://stackoverflow.com/questions/11225051/how-to-read-xml-file-in-c[^]
这篇关于如何仅使用XElement类循环此字符串列表并显示以下输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文