如何在Silverlight 4.0中将Xml字符串转换为ObservableCollection [英] How to convert Xml string to ObservableCollection in Silverlight 4.0

查看:54
本文介绍了如何在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....

推荐答案

应该执行以下操作(我们需要查看实际的XML结构以更具体). .

首先添加以下using语句:

Something like the following should do it (we''d need to see your actual XML structure to be more specific)...

First add these using statements:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆