tags:

views:

52

answers:

2

I want to use this in my application but I'm getting an error for

GetByLatest().Cast<IRss>();

I am getting an error to this line GetByLatest(),please tell how shall I implement this one

Please suggest a solution

IList<IRss> news = new Trytable().GetByLatest().Cast<IRss>();
return new RssResult(news, "William Duffy - Glasgow Based ASP.NET Web Developer",
        "The latest news on ASP.NET, C# and ASP.NET MVC ");
+1  A: 

The result of Cast will be IEnumerable<IRss> - not IList<IRss>. If you want to use an IList<IRss> variable you need to call ToList (or ToArray):

IList<IRss> news = new Trytable().GetByLatest().Cast<IRss>().ToList();
Jon Skeet
A: 

A Google search for William Duffy indicates that you were trying to use this code:

        IEnumerable<IRss> news = new NewsService().GetByLatest().Cast<IRss>();
        return new RssResult(news, "William Duffy - Glasgow Based ASP.NET Web Developer", "The latest news on ASP.NET, C# and ASP.NET MVC ");

Can you explain what you're trying to do so we can actually help?

Gabe