开发者

How to Cache Ienumerable var

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜