Combining two SyndicationFeeds

后端 未结 6 1583
無奈伤痛
無奈伤痛 2021-02-08 13:05

What\'s a simple way to combine feed and feed2? I want the items from feed2 to be added to feed. Also I want

6条回答
  •  自闭症患者
    2021-02-08 13:32

    Well, one possibility is to create a new syndication feed that is a clone of the first feed, and then simply iterate through each post on the second one, check the first for its existence, and add it if it doesn't exist.

    Something along the lines of:

    SyndicationFeed newFeed = feed.clone;
    foreach(SyndicationItem item in feed2.items)
    {
      if (!newFeed.contains(item))
        newFeed.items.Add(item);
    }
    

    might be able to do it. It looks like 'items' is a simple enumberable list of syndication items, so theres not reason you can't simply add them.

提交回复
热议问题