Domanda

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;

        }
      }

   }
}
È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top