本文介绍了如何在Silverlight 4.0中将Xml字符串转换为ObservableCollection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


任何人都可以帮助将XmlString转换为ObservableCollection.我将xml数据放入一个字符串中,并且必须从该字符串中创建ObservableCollection.

在此先感谢....

Hi
Can anybody help in converting XmlString to ObservableCollection. I get the xml data into a string and from that string i must create ObservableCollection.

Thanks in advance....

推荐答案

using System.Xml;
using System.Xml.Linq;



然后将您的字符串转换为XmlDocument:



Then convert your string to an XmlDocument:

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(myXmlString);



然后像 this 一样使用LINQ到Xml. .


希望有帮助.



And then use LINQ to Xml like this.


Hope that helps.


这篇关于如何在Silverlight 4.0中将Xml字符串转换为ObservableCollection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 23:39