【问题标题】:extract elements from xml document从xml文档中提取元素
【发布时间】:2012-12-26 15:46:57
【问题描述】:

我有一个 xml 文档,我想在其中提取每 10 个元素。我使用这段代码来提取最后 10 个元素,但我的想法是在它们之前获取接下来的 10 个元素,因为我得到了整个文档,所以我不能对 linq 使用分页:

slideView.ItemsSource = 
    (from channel in xmlItems.Descendants("album")     
     orderby (int)channel.Element("catid") descending 
     select new onair
     {
         title = (string)channel.Element("name"),
         photo = (string)channel.Element("picture")
     }).Take(10);

有什么想法吗? 谢谢

【问题讨论】:

    标签: windows-phone-7 linq-to-xml


    【解决方案1】:

    在查询结束时尝试 .Skip(10).Take(10)。

    【讨论】:

    • 你好,好的,它完成了这项工作,但它会将旧列表更改为另一个带有其他 10 个元素的列表,除了我想动态地制作它,这意味着每次按下按钮时,旧列表仍然和我们得到接下来的 10 个,等等。谢谢:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-06
    • 1970-01-01
    • 2012-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多