.ini文件将其替换为XML? [英] .ini Files replace them with XML?

查看:100
本文介绍了.ini文件将其替换为XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在一个项目的阶段之间有一段距离,并且想了解有关xml与ini辩论"的一些信息,我一直使用来自VB6的ini文件(昨天完成),这似乎是打开文本文件最快的方法富文本框,然后使用InStr()搜索字符串.到目前为止,我还没有与其他程序员一起在.NET中做一个大型应用程序,我做了上面的C#应用​​程序的唯一部分,但是使用了.subString,而与我一起工作的另一个人没有提出异议.因此,XML的优势是什么,我看到的唯一问题是,如果subString中爬行的空间会产生适合的情况.

Glenn

Hi,

I have a gap between phase in a project and would like to know something about xml vs. ini ''debate'' I have always used ini files coming from VB6 (get it done yesterday) it seem the quickest way open a text file into rich text box and go string hunting with InStr(). So far I have not yet had to do a major app in .NET with other programmers the only bit of a C# app I did the above but used .subString and the other guy I was working with raised no objections. So what is the advantage of XML, the only issue I saw was if a space creeped in the subString would throw a fit.

Glenn

推荐答案

可读性.
如果操作正确(通过项目中解决方案资源管理器中属性下的Setting.settings),则可以使用可读代码,例如
Readabillity.
If you do it properly (via Setting.settings in your project, under properties in the Solution Explorer) then you can use readable code, such as
string imagePath = Properties.Settings.Default.imagePath;
...
Properties.Settings.Default.imagePath = @"D:\Temp\MyImage.jpg";
Properties.Settings.Default.Save();

每个设置都彼此分开.然后,该框架处理实际的设置文件,以XML格式存储数据,而不必确保将其保存在正确的位置,等等,等等.

With each setting kept separate from each other. The framework then deals with the actual settings file, storing data in XML, instead of you having to make sure it is in teh right place, etc., etc.


文件超过INI是树结构.如您所知,INI文件在section内具有{key, value}对.另一方面,XML文件具有任意深度"树层次结构(例如,"vituperated" Windows注册表).
One advantage of XML files over INI ones is the tree structure. As you know INI files have {key, value} pairs inside sections. XML files, on the other hand have an ''arbitrary deep'' tree hierarchical structure (like for instance, the ''vituperated'' Windows registry).


这篇关于.ini文件将其替换为XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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