用户定义类的XML属性 [英] XML Attribute for a user defined class
本文介绍了用户定义类的XML属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我为正在执行序列化过程的类提供一些属性.
我已经为自定义类型的类编写了一个属性.
序列化后的输出如下:
Hi
I have some properties for the class which is doing the serializing process.
I have written a property for the class which the type is custom.
after serialization the output is like below:
<?xml version="1.0" encoding="UTF-8"?>
-<Persons xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> -<Students> <Name>BehnouD</Name> <Family>Sherafati</Family> -<Account> <Number>10000</Number> </Account> </Students>
我想像其他属性一样具有Account属性的格式.
我该怎么办?
Tnx
I want to have the format of Account property like other properties.
what can I do?
Tnx
推荐答案
在此处浏览每个示例- http://www.switchonthecode.com/tutorials/csharp-tutorial-xml-serialization [ ^ ],并尝试了解XmlAttribute和XmlElement.希望它能解决您的问题.
Go thru each examples here - http://www.switchonthecode.com/tutorials/csharp-tutorial-xml-serialization[^] and try to understand the XmlAttribute and XmlElement. Hope it solve your issue.
这篇关于用户定义类的XML属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文