I'm wondering how to merge several RSS feeds using the SyndicationFeed class?
Asked
Active
Viewed 210 times
0
-
Have you tried `var joinedFeeds = syndicationFeed1.Items.Concat(syndicationFeed2.Items)` ? – L.B Oct 18 '12 at 15:39
-
This doesn't work: `public static SyndicationFeed MergeFeeds(SyndicationFeed sf1, SyndicationFeed sf2){ sf1.Items.Concat(sf2.Items); return sf1; }` – Pamplemousse Oct 19 '12 at 13:26
-
Because it must be `public static IEnumerable
MergeFeeds(SyndicationFeed sf1, SyndicationFeed sf2) { return sf1.Items.Concat(sf2.Items); }` – L.B Oct 19 '12 at 14:03 -
I will try it but can I convert the IEnumerable
into SyndicationFeed? Because I need a SyndicationFeed as return... – Pamplemousse Oct 19 '12 at 14:42 -
I will try: `public static SyndicationFeed MergeFeeds(SyndicationFeed sf1, SyndicationFeed sf2) { return (SyndicationFeed)sf1.Items.Concat(sf2.Items); }` – Pamplemousse Oct 19 '12 at 14:43
-
As expected: _Unable to cast object of type '
d__71`1[System.ServiceModel.Syndication.SyndicationItem]' to type 'System.ServiceModel.Syndication.SyndicationFeed'_. – Pamplemousse Oct 19 '12 at 14:44 -
When I do your trick it returns a new SyndicationFeed with Items as {System.Linq.Enumerable.ConcatIterator
} – Pamplemousse Oct 19 '12 at 14:56