数据源到XML文件 [英] Datasource to XML file
本文介绍了数据源到XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个收藏夹,我想写到xml文件.
Hi,
I have a collection and i want to write to xml file. can anyone help?
推荐答案
如果它是复杂对象的集合(相对于简单的固有类型),则可以创建一个属性,该属性可以将对象作为XElement返回,或者您可以使用XML序列化.
我个人更喜欢财产法.
如果它们不是复杂的类型,则可以为所需类型编写扩展方法,该方法只返回一个XElement.
像程序员一样有趣吗?
If it''s a collection of complex objects (versus simple intrinsic types), you could create a property that can returns the objects as XElements, or you could use XML serialization.
I personally prefer the property approach.
If they''re not complex types, you could write extension method for the desired type that simply returns a XElement.
Isn''t being as programmer fun?
这篇关于数据源到XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文