如果您喜欢解决问题,这里有一个大问题:D
首先,这不是关于序列化的,好吗?
嗯,我的情况是...我正在编写一个函数,我将其作为参数传递Xml(XmlDocument)和对象(Object)的引用。它会将通过Xml(XmlDocument)填充值的对象(已引用的对象)返回给我。
例如:
我有一个像下面的Xml:
<user>
<id>1</id>
<name>Daniel</name>
</user>
我有一个函数。
public Object transformXmlToObject (XmlDocument xml, Object ref)
{
// Scroll each parameters in Xml and fill the object(ref) using reflection.
return ref;
}
我将如何使用它?
我会像这样使用:
[WebMethod]
public XmlDocument RecebeLoteRPS(XmlDocument xml)
{
// class user receive the object converted from the function
User user = new User();
user = transformXmlToObject(xml, user);
// object filled
}
大家好,我需要帮助。
最好的问候, 丹