views:

69

answers:

1

I have the following code :

XDocument xResponse = XDocument.Parse(strXMLResponse);

var vMyData = from xmyInfo in xResponse.Descendants("Result").Elements("item")
select new myProporties
{
      strmyInfo1 = ((string)xmyInfo .Element("el1")).Trim(),
      strmyInfo2 = ((string)xmyInfo .Element("el2")).Trim(),
      strmyInfo3 = (string)xAudioinfo.Element("el3")
};

Now I want to cache the vMyData having dependency on strXMLResponse.

Thanks

A: 
vMyData = vMyData.ToList();

This will enumerate your IEnumerable and capture the result into a List<T> (which is then idempotent).

Johannes Rudolph