2010-03-11 9 views
0

je le code suivant:Comment mettre en cache IEnumerable var

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") 
}; 

Maintenant, je veux mettre en cache la dépendance à l'égard vMyData ayant strXMLResponse.

Merci

+0

Commentaires?! ..... –

Répondre

1
vMyData = vMyData.ToList(); 

Cela énumérerons votre IEnumerable et saisir le résultat dans un List<T> (qui est alors idempotent).

Questions connexes