如何填寫Object Array
內LINQ Query
填充對象數組
這裏是我的數據模型
public class Test
{
public string Link { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public Item[] Items { get; set; }
}
public class Item
{
public string Title { get; set; }
public string Link { get; set; }
public string Guid { get; set; }
public DateTime PublishDate { get; set; }
public string Description { get; set; }
}
這裏是查詢
var data = from feed in feedXml.Descendants("channel")
select new Rss
{
Title = feed.Element("title").Value,
Link = feed.Element("link").Value,
Description = feed.Element("description").Value,
Items = // here i have to fill the array of items
};
UPDATE XML甲酸鹽
<channel>
.....
<item>.....</item>
<item>.....</item>
<item>.....</item>
</channel>
<channel>
.....
<item>.....</item>
<item>.....</item>
<item>.....</item>
</channel>
<channel>
.....
<item>.....</item>
<item>.....</item>
<item>.....</item>
</channel>
提供您的xml文件格式。 –