如何按xml的物理顺序读取用户属性? [英] How to read the user properties in physical order of the xml ?

查看:110
本文介绍了如何按xml的物理顺序读取用户属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#Framework v4.5 +

在WinForm应用程序上我正在尝试:



foreach( Properties.Settings.Default.Properties中的SettingsProperty数据为IEnumerable)

{

MessageBox(Name =(+ data.Name +)\ n\\\
Value =(+ data.DefaultValue +));

}



但它不按物理顺序读取......

我需要尊重XML文件的顺序。



对不起我的英文;-)

谢谢!

I'm using C# Framework v4.5+
On a WinForm App I'm trying to do:

foreach(SettingsProperty data in Properties.Settings.Default.Properties as IEnumerable)
{
MessageBox("Name = (" + data.Name + ")\n\nValue = (" + data.DefaultValue + ")");
}

But it's not reading in physical order...
I need that respect the order of the XML file.

Sorry for my english ;-)
Thanks!

推荐答案

请参阅我对该问题的评论。首先,这一切都与WinForm无关。另外,一般来说,很难读出不是物理顺序的东西,但无论如何,为了安全起来:-),无论你想读什么,你总是可以通过单向物理顺序读取所有内容-only样式使用类 System.Xml.XmlTextReader:

https://msdn.microsoft.com/en-us/library/system.xml.xmlreader%28v=vs.110%29 .aspx [ ^ ]。 :-)



-SA
Please see my comment to the question. First of all, it all has nothing to do with "WinForm". Also, generally, it's pretty hard to read something not in "physical order", but anyway, to be on safe side™ :-), no matter what you want to read, you can always read everything in one-way physical-order-only style using the class System.Xml.XmlTextReader:
https://msdn.microsoft.com/en-us/library/system.xml.xmlreader%28v=vs.110%29.aspx[^]. :-)

—SA


这篇关于如何按xml的物理顺序读取用户属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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