I have the following code :
XDocument xR开发者_高级运维esponse = 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
vMyData = vMyData.ToList();
This will enumerate your IEnumerable
and capture the result into a List<T>
(which is then idempotent).
精彩评论