How to Storing XDocument object result to an ICollection object? RRS feed

  • Question

  • Hi,
       I have the following Code That fetches Products from CRM.

    string fetch = @" <fetch mapping=""logical"">
                                 <entity name=""product"">

                    String resultProductList = crm.Fetch(fetch);

                    XDocument xmlProductList = XDocument.Parse(resultProductList);


    My question is how do i store the xmlProductList  values to an appropriate data structure so i can Iterate the values or even bind those values to an Dropdown List or any Data set.

    i want to avoid the below type code for accessing.

    var query = from m in xmlProductList.Descendants("result")
                                select new
                                    ProductID = (string)m.Element("productid"),
                                    Name = (string)m.Element("name"),

    Which is the Best Method for implementation 
    Friday, April 17, 2009 9:42 AM