none
Convert ObservableCollection to List<myType>

    Question

  • Posted this in a general Silverlight Forum before I saw this one:

     

    I am currently working on my first test using SL 4 and a service to return data:

    I am reading an XML file --> formatting into a class type RSSItems, however when the data is returned I get an ObservableCollection<ToadWebservice.RSSItem>.  I cannot seem to figure out how to get it into the type I need. <ToadReader.RSSItem>.

    Any ideas?  This is my first attempt with this type of project and I am unsure if I am even going down the right path.

    example:

        List<RSSItem> myFeeds = e.Result;

     

     

    Get an error on the conversion of e.Result to List<RSSItem>.

    Thanks,

    Just A Little Frustrated...

    Todd

    Thursday, October 21, 2010 5:03 PM

Answers

All replies

  • Hi, 


    List<RSSItem> myFeeds = new List<RSSItem>();

    foeach(RSSItem item in e.Result)

    {

    myFeeds.Add(item);

    }


    Best Regards.

    Thursday, October 21, 2010 5:08 PM
  • Thanks for the response:

    However i am getting the following error, on I seem to not be able to get around:

    Cannot convert type 'ToadReader.ToadWebService.RSSItem' to 'ToadReader.RSSItem'

     

    I am not sure if I quite understand the difference why one is ToadReader.ToadWebService.RSSItem and the other just ToadReader.RSSItem.  This is the point where I have remained stuck.

    Any other ideas/suggestions/insight?

    Thanks,

    Todd

    Thursday, October 21, 2010 6:48 PM
  • Hi,

    The solution has been delievered to this duplicate post, so this one is closed.

     

    Best Regards,

    Friday, October 29, 2010 6:19 AM