Combining two SyndicationFeeds

后端 未结 6 1567
無奈伤痛
無奈伤痛 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:23

    This worked fine for me:

    // create temporary List of SyndicationItem's
    List tempItems = new List();
    
    // add all feed items to the list
    tempItems.AddRange(feed.Items);
    tempItems.AddRange(feed2.Items);
    
    // remove duplicates with Linq 'Distinct()'-method depending on yourattributes
    
    // add list without duplicates to 'feed2'
    feed2.Items = tempItems
    

提交回复
热议问题