Reputation: 491
I'm trying to read rss feeds using Syndicationfeed class. I have added a reference to System.servicemodel.syndication.
this is my error Project.SyndicationFeed' does not contain a definition for 'Load'
Here's my code: (console application)
using System;
using System.Xml;
using System.ServiceModel.Syndication;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
string url = "http://fooblog.com/feed";
XmlReader reader = XmlReader.Create(url);
SyndicationFeed feed = new SyndicationFeed();
feed = SyndicationFeed.Load(reader);
reader.Close();
foreach (SyndicationItem item in feed.Items)
{
String subject = item.Title.Text;
String summary = item.Summary.Text;
}
}
}
}
Upvotes: 1
Views: 1032
Reputation: 491
The problem was that somehow a class SyndicationFeed.cs got added to my project which caused conflicts when calling the .Load() method.
After deleting this file from the class everything went fine.
Thanks to @user2864740 for pointing this out and leading me to the solution.
Upvotes: 1